func runTextureCompiler(basePath: String, outPath: String, params: [String]) -> Int32 { var blob: [CChar] = []; var offsets: [Int] = []; //Reserve capacity for all strings in line blob.reserveCapacity(params.reduce(0, { r, v in r + v.count })); offsets.reserveCapacity(params.count); //Iterate parameters and place them in the new contiguous array params.forEach({ v in offsets.append(blob.count); blob.append(contentsOf: v.cString(using: .utf8) ?? []); }); return blob.withUnsafeBufferPointer({ buffer in let ptr = buffer.baseAddress!; let strings: [UnsafePointer?] = offsets.map({ v in ptr + v }); return basePath.withCString({ basePathPtr in outPath.withCString({ outPathPtr in run_ios_test(basePathPtr, outPathPtr, strings, params.count) }) }); }); }