Matej Kormuth
10/26/2018, 10:04 AMint func(const char* src...);
that I use with cinterop. I want to pass inside CPointer<ByteVar>
or CPointer<UByteVar>
as a parameter (because char* is pointer to char) that a aquired from previous native call. However the function has in kotlin binding header public fun func(source: kotlin.String?...
accepting kotlin string. How do I do it? Do I need to call toKString()
? Doesn't toKString()
involve some allocation? Does it correctly translates the CPointer<ByteVar>
buffer to string (without some corruption due to encoding for example)? Isn't it useless step as the KString will have to be translated back to C char array later?Matej Kormuth
10/26/2018, 10:17 AMMatej Kormuth
10/26/2018, 10:19 AMfun func(source: String?...): Int {
memScoped {
return kniBridge25(source?.cstr?.getPointer(memScope).rawValue ...)
}
}
Matej Kormuth
10/26/2018, 10:20 AMMatej Kormuth
10/26/2018, 10:21 AMmsink
10/26/2018, 10:35 AMnoStringConversion = func
in .def fileMatej Kormuth
10/26/2018, 10:48 AM