Hi there!, Have a question about K/N. Is it possib...
# kotlin-native
r
Hi there!, Have a question about K/N. Is it possible to use it as a replacement for JNI?. I have a cross-platform written in C/C++ library that I use for ios/android, Can I call this library from an Android application using Kotlin/Native?
🚫 2
d
K/N does not replace JNI sadly. It's very separate from the jvm.
r
let's say I create a K/N library with an android binary (I assume this is possible). How can I use that library from an Application?
Should I write a JNI layer to interact with it?
d
Yes, you have to write a JNI layer in Kotlin/Native to allow Kotlin/JVM to call it.
r
👍 understood
It would be nice to be able to call c libraries from Kotlin/JVM without all the JNI mess
💯 1
d
Yeah, I'm sure someone out there will make a tool for this at some point.
n
Would be nice if the Kotlin Native team, and the GraalVM team collaborated on a new system. This system would be a communication layer between Kotlin Native, and GraalVM which enables Kotlin Native libraries to be used on the GraalVM side via a JVM language (eg Kotlin via Kotlin JVM).
GraalVM already has compatibility with some LLVM based languages ( https://www.graalvm.org/docs/reference-manual/languages/llvm/ ). If the Kotlin Native team plans to incorporate LLVM bit code support into klibs (Kotlin Native libraries), then that opens the door to the possibility of a GraalVM communication layer (☝️).