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
uli
10/12/2021, 4:43 PM
Looks like you are out of your mind 🙂
JNI, as the name suggests is only for java environments. But you guessed it already 😉
uli
10/12/2021, 4:45 PM
Looks like JetBrains were out of their mind 🙂 Leaving discussion to the big thread on your latest message
n
napperley
10/12/2021, 11:38 PM
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)?
napperley
10/12/2021, 11:39 PM
At the end of the day the same programming language is used, with the only difference being the platform.
napperley
10/12/2021, 11:41 PM
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
Landry Norris
10/13/2021, 6:47 PM
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