Zode
12/14/2021, 3:29 AMRUNTIME_NOTHROW void Kotlin_initRuntimeIfNeeded()
do? This function is in kotlin/kotlin-native/runtime/src/main/cpp/Runtime.cpp
.
1. I found it got called all the time when trying to run my iOSApp, then I got a runtime exception when it ran into InitOrDeinitGlobalVariables(INIT_GLOBALS, result->memoryState);
. It looks like the runtime environment had not fully created at that point, and it has already called OC bridge function, then caused an exception.
2. I also found another problem when using k/n. Top-level properties declared in kotlin will always return null when running iOSApp. I made it a top-level function and it worked. This problem also happened when KN was running into Kotlin_initRuntimeIfNeeded()
.
3. btw, debug shared.framework and k/n lib with disasm showed in lldb is tough. Is there any way to debug k/n from source when running iOSApp?
Does anyone has any idea here?Joakim Forslund
12/14/2021, 9:41 AMZode
12/14/2021, 9:42 AMJoakim Forslund
12/14/2021, 9:46 AMinitRuntimeIfNeeded
does is just to actually start/init the called library on the current thread if it already is not.
So it is a way to make sure you can access certain runtimes when doing threaded workJoakim Forslund
12/14/2021, 9:49 AMZode
12/14/2021, 10:06 AMJoakim Forslund
12/14/2021, 10:09 AMnatario1
12/14/2021, 10:39 PMZode
12/15/2021, 3:19 AM