napperley
06/13/2022, 11:37 PMephemient
06/14/2022, 12:06 AMephemient
06/14/2022, 12:13 AMmemScoped {
allocArrayOf(strings.map { it.cstr.getPointer(this) } + null)
}
napperley
06/14/2022, 12:49 AMtoCStringArray
function supposed to behave (aka what should be happening "under the hood")?napperley
06/14/2022, 12:53 AMfun Array<String>.toCArray(): CArrayPointer<CPointerVar<ByteVar>> = memScoped {
val result = allocArray<CPointerVar<ByteVar>>(size + 1)
@Suppress("ReplaceRangeToWithUntil")
(0..(size - 1)).forEach { result[it] = this@toCArray[it].cstr.getPointer(this) }
result[size] = null
result
}
ephemient
06/14/2022, 12:55 AMresult
there is really not what you should be doing - that's dangling memoryephemient
06/14/2022, 12:56 AMPavel Kunyavskiy [JB]
06/14/2022, 6:07 AM