Do C function pointer callbacks with pointer parameters always have the parameters mapped as CPointer rather that CValuesRef?
Is this because they are called directly rather than through a KLib wrapper? Does this mean if passing in strings you have to allocate and free (or use getPointer within a memScoped)?
a
Artyom Degtyarev [JB]
11/06/2019, 10:49 AM
Hello! If I understand it correctly, the answer is “yes”. But, why don’t you use
.cstr/.toKString
conversions? I’m not sure that manual allocation is needed here.
e
Eamonn Boyle
11/06/2019, 11:54 AM
The signature of the function is CPointer rather than CPointed so the .cstr won’t work on it’s own (it returns CValues). So I have to call .cstr.getPointer(memScope) to allocate it.