Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Native C library in Kotlin-JVM/Android

Is there any way to use native C libraries in kotlin-jvm without JNI? The use case is simple, I want to use kotlin wrappers around native libraries like SQLite without painful JNI work. I didn't find anything in samples except the one with NativeActivity.

Everything that I found about the topic is this thread, which is not very detailed: https://discuss.kotlinlang.org/t/interoperability-between-kotlin-native-and-kotlin-jvm/5943

like image 207
CodeReader Avatar asked Sep 16 '25 06:09

CodeReader


1 Answers

As Eugene pointed out, its not possible, not without JNI. I've used Djinni from the good folks at Dropbox. While not a silver bullet, it really does reduce the pain of JNI work. I should also point out its designed to work with C++, not C per se. But perhaps its still of use to you.

like image 142
Michael Marsella Avatar answered Sep 19 '25 02:09

Michael Marsella