# Interop with non-Java libraries (FFI?)

**URL:** <https://discuss.kotlinlang.org/t/interop-with-non-java-libraries-ffi/1378>\
**Category:** Support\
**Created:** [December 24, 2015, 2:11am UTC](https://discuss.kotlinlang.org/t/interop-with-non-java-libraries-ffi/1378 "2015-12-24T02:11:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![seandmccarthy](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/seandmccarthy/32/1687_2.png) [@seandmccarthy](https://discuss.kotlinlang.org/u/seandmccarthy)\
**Post date:** [December 24, 2015, 2:11am UTC](https://discuss.kotlinlang.org/t/interop-with-non-java-libraries-ffi/1378/1 "2015-12-24T02:11:09Z")

</div>

In the Interop section of the documentation it talks about calling out to Java libraries (and vice versa), but it’s not clear how interop with other libraries (e.g. C libraries) should be done. JRuby, for example, has an FFI library, thus removing the need to use JNA directly. Will Kotlin provide a similar library?

---

<div class="post-metadata">

**Author:** ![mikehearn](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/mikehearn/32/1424_2.png) [@mikehearn](https://discuss.kotlinlang.org/u/mikehearn)\
**Post date:** [December 24, 2015, 12:57pm UTC](https://discuss.kotlinlang.org/t/interop-with-non-java-libraries-ffi/1378/2 "2015-12-24T12:57:11Z")

</div>

The JRuby FFI exists to map the Ruby API to JNA, to keep compatibility with existing code. Kotlin doesn’t have a native FFI and so why would you add one just to map it to JNA/JNI/Panama later? You could as well use these things directly.

---

<div class="post-metadata">

**Author:** ![abreslav](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/abreslav/32/8279_2.png) [@abreslav](https://discuss.kotlinlang.org/u/abreslav)\
**Post date:** [December 25, 2015, 4:12pm UTC](https://discuss.kotlinlang.org/t/interop-with-non-java-libraries-ffi/1378/3 "2015-12-25T16:12:38Z")

</div>

Kotlin supports JNI through the “external” modifier.

Here’s an example (need to replace “native” with “external”):

> <https://github.com/ligee/kotlin-ndk-samples/blob/master/hello-jni/src/com/example/hellojni/HelloJni.kt>
