Are coroutines supposed to work in Native modules?...
# kotlin-native
y
Are coroutines supposed to work in Native modules? Trying to create my own simple implementation for iOS, this simple declaration alone in Native (or common) module crashes compiler:
Copy code
fun launchAsync(context: CoroutineContext, block: suspend () -> Unit) {
    TODO()
}
With
Copy code
exception: java.lang.Error: Invalid module
        at org.jetbrains.kotlin.backend.konan.llvm.IrToBitcodeKt.verifyModule(IrToBitcode.kt:117)
        at org.jetbrains.kotlin.backend.konan.llvm.IrToBitcodeKt.verifyModule$default(IrToBitcode.kt:108)
        at org.jetbrains.kotlin.backend.konan.Context.verifyBitCode(Context.kt:313)
        at org.jetbrains.kotlin.backend.konan.KonanDriverKt$runTopLevelPhases$4.invoke(KonanDriver.kt:99)
👍🏼 1
youtrack 1
o
Yes, they supposed to work, so please file issue. https://github.com/JetBrains/kotlin-native/tree/master/samples/nonBlockingEchoServer is a coroutine example.
👌 1
s
The problem is appears only when compiling code to framework with Kotlin/Native. The bug will be fixed soon. Until that, you can workaround it by making the function
private
.