I believe I've seen several repos (include JetBrai...
# kotlin-native
g
I believe I've seen several repos (include JetBrains' own) using JNI to write functions that get used in both JVM apps, and in Kotlin Native. If true, how does this work? Since JNI requires the
JNIEnv*
param implicit in all calls. Or am I out of my mind haha
u
Looks like you are out of your mind 🙂 JNI, as the name suggests is only for java environments. But you guessed it already 😉
Looks like JetBrains were out of their mind 🙂 Leaving discussion to the big thread on your latest message
n
Why isn't the Kotlin team developing a new Kotlin feature where a Kotlin Native library can be developed which can be accessed by Kotlin JVM (will require two way interop between Kotlin JVM and Kotlin Native)?
At the end of the day the same programming language is used, with the only difference being the platform.
Would be much easier if the Kotlin team could make JNI redundant if one is only dealing with Kotlin libraries throughout the entire stack.
l
I've seen some projects that structure JNI calls by writing all the logic in C methods, then having a jni.c file that just has JNI namespaced methods that wrap the C methods. Added bonus is you can use the code in any C program just without including jni.c