SrSouza
02/25/2022, 12:21 AMgildor
02/25/2022, 2:57 AMWhy the JNI implementation is written in C++ and not exposed by Kotlin NativeThere is no interopability between K/N and JVM, so it still require JNI (or similar mechanisms) as with any other native API
gildor
02/25/2022, 2:58 AMSrSouza
02/25/2022, 3:22 AM@CName("Java_org_jonnyzzz_jni_java_NativeHost_callInt")
fun callInt(env: CPointer<JNIEnvVar>, clazz: jclass, it: jint): jint {
initRuntimeIfNeeded()
Platform.isMemoryLeakCheckerActive = false
println("Native function is executed with: $it")
return it + 1
}
From: https://jonnyzzz.com/blog/2019/12/15/jni-kotlin/
Hopefully in short future we have KN/JVM interop because would be a big plus for native libraries, specially desktop ones that most of the code is Native librariesgildor
02/25/2022, 3:23 AMHopefully in short futureI’m very doubt about this. Though I would love to see such feature
gildor
02/25/2022, 3:26 AMI mean something like this:This is not a JNI per se, this is essentially exposing K/N API as C API
Albert Chang
02/25/2022, 3:36 AMgildor
02/25/2022, 3:57 AMgildor
02/25/2022, 3:57 AMgildor
02/25/2022, 3:58 AMgildor
02/25/2022, 4:00 AMAlbert Chang
02/25/2022, 4:07 AMgildor
02/25/2022, 4:07 AMgildor
02/25/2022, 4:08 AMgildor
02/25/2022, 4:08 AMgildor
02/25/2022, 4:09 AMSrSouza
02/25/2022, 12:17 PMgildor
02/25/2022, 2:41 PMgildor
02/25/2022, 2:42 PM