I've had a look at the C interop documentation and...
# kotlin-native
p
I've had a look at the C interop documentation and I was wondering if the
kotlin.native.initRuntimeIfNeeded()
function has to be called from. Is it inside the staticCFunction or outside of it? Should I call it at the beginning of the function?
n
The
initRuntimeIfNeeded
function is called in the event handler. Will require using the function if multiple threads are being used by the C library in question. Not all C libraries are multi threaded.
It is easier to test without using the function to see if it is needed. Just make sure something in the C library causes the event to occur, and see if a segmentation fault occurs. In the event that a segmentation fault occurs that means the
initRuntimeIfNeeded
function is required.
p
Does that mean I only need that function if the C library is multi threaded, not if my K/N code is multi threaded?
👌 1
We found the issue now, it has something to do with blocking code that we missed
Thanks for all your help