Hi all, I want to ask related to Cinterop code tha...
# multiplatform
d
Hi all, I want to ask related to Cinterop code that produce function like this :
fun myFunction(param1 : String, error : error : CPointer<ObjCObjectVar<NSError?>>?)
how to user that kind of CPointer type ?
a
Hello, @Davin reinaldo gozali! You have to allocate an object containing
NSError
and send the pointer to the function. IIRC, something like that should work
Copy code
memScoped {   // All objects allocated in this block will be marked as free when its over, I use it for simplicity here.
   val startError = alloc<ObjCObjectVar<NSError?>>()
   myFunction(param1 = "Hello", error = startError.ptr))
}
👍 1
d
okay, that works.. thank you