Sebastian Keller
CPointer<BooleanVar>
val flag = nativeHeap.alloc<BooleanVar>(); flag.usePinned { it.get().ptr /* <- CPointer<BooleanVar> */}
fun fileExistsAtPath(path: String, isDirectory: CPointer<BooleanVar?): Boolean
path
jonnyzzz
cValue<T>(){...}
memScope{..}
nativeHeap
bool b = false; bool *ptr = &b; functionThatUsesBoolPtr(ptr);
import kotlinx.cinterop.BooleanVar import kotlinx.cinterop.CPointer import kotlinx.cinterop.alloc import kotlinx.cinterop.memScoped import kotlinx.cinterop.ptr import kotlinx.cinterop.value fun x(b: CPointer<BooleanVar>?) = 42 val test = memScoped { x(alloc<BooleanVar> { value = false }.ptr) }
alloc
memScoped
A modern programming language that makes developers happier.