I am currently developing an Android app written in Kotlin and C++, which used JNI to bind C++ to Java and thereby Kotlin. The C++ part is written using JUCE, a cross-platform library. In order to avoid code duplication on iOS, and simplify future development, I am looking into Kotlin Multiplatform to separate the “business logic” parts of the app into a klib.
It looks like Kotlin Native is fully capable of interop with C and thereby C++ (with
extern C blocks). What I am not clear on, is if I can call into C code from the klib. What I would like is to bypass JNI and be able to call into C++ code directly from Kotlin, as well as provide callbacks for the C++ code to call Kotlin methods.
Is this possible? Are there any examples of Multiplatform libraries that do this?