# Kotlin JVM app that calls Kotlin/Native library

**URL:** <https://discuss.kotlinlang.org/t/kotlin-jvm-app-that-calls-kotlin-native-library/14507>\
**Category:** Native\
**Created:** [October 2, 2019, 10:36pm UTC](https://discuss.kotlinlang.org/t/kotlin-jvm-app-that-calls-kotlin-native-library/14507 "2019-10-02T22:36:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![fedorov1984](https://avatars.discourse-cdn.com/v4/letter/f/c0e974/32.png) [@fedorov1984](https://discuss.kotlinlang.org/u/fedorov1984)\
**Post date:** [October 2, 2019, 10:36pm UTC](https://discuss.kotlinlang.org/t/kotlin-jvm-app-that-calls-kotlin-native-library/14507/1 "2019-10-02T22:36:21Z")

</div>

I have pure Kotlin(JVM) app. and I want to use some native library( C lib on linux). Is it possible to do with Kotlin/Native?

If it is, how it is different from JNI, is it faster, better or not?

What kind of bridge is used to call native code under JVM?

---

<div class="post-metadata">

**Author:** ![Artyom.Degtyarev](https://avatars.discourse-cdn.com/v4/letter/a/ad7895/32.png) [@Artyom.Degtyarev](https://discuss.kotlinlang.org/u/Artyom.Degtyarev)\
**Post date:** [October 3, 2019, 7:56am UTC](https://discuss.kotlinlang.org/t/kotlin-jvm-app-that-calls-kotlin-native-library/14507/2 "2019-10-03T07:56:52Z")

</div>

Hello!  
It looks like you misunderstand the concept of the Kotlin/Native. It is not JNI analog, but the standalone compiler. It makes possible to write code in Kotlin, with slight differences, and to compile it into the binary files. Also, with Kotlin/Native one can use C libraries very easy, but this is not a transferrable option. To say, even more, to call something written in Kotlin/Native from the Kotlin/JVM one got to use JNI!  
So, to conclude everything I said, Kotlin/Native is not a way to use the C library in the Kotlin/JVM app. But, this is the way to write a native app that uses platform-specific C libraries.

---

<div class="post-metadata">

**Author:** ![darksnake](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/darksnake/32/2479_2.png) [@darksnake](https://discuss.kotlinlang.org/u/darksnake)\
**Post date:** [October 3, 2019, 8:20am UTC](https://discuss.kotlinlang.org/t/kotlin-jvm-app-that-calls-kotlin-native-library/14507/3 "2019-10-03T08:20:07Z")

</div>

In fact, K-N could be also a way to work with native libs from JVM if there were a way to make bridge calls from K-JVM to K-N and back. It was discussed multiple times, so I think that the feature is on TODO list somewhere, but not the first priority.
