Making Existing Native Code Available in Kotlin
summary
Shows how to call existing C/C++ libraries from Kotlin two ways: Kotlin/Native uses JetBrains CInterop with a small .def file to generate a .klib that links to the shared lib so you only need one wrapper; compilation uses gcc flags like -fPIC -shared .dylib. JVM requires writing a JNI C wrapper (example named greeter_jni) and building two shared libraries, then running a self‑executable jar with java -Djava.library.path; provided examples compile and run and full code is on GitHub.
AI-written summary · about
chapters (8)
- 0:00Intro
- 0:29C Interop on Two Platforms
- 0:52Let's Build A C Library
- 2:36C-Interop for Kotlin Native
- 5:43Using libgreeter.klib
- 8:19Kotlin JVM: JNI (Java Native Interface)
- 9:11Kotlin JVM: JNI Conversion Library
- 13:25Kotlin JVM: Using JNI Conversion Library
related talks
52mKEYNOTE: Kotlin/Native – Embracing existing ecosystems
40mKMP with non-Kotlin languages
22mIntegrate Multiple Kotlin/Native Libraries into Your Android/iOS Apps, Vincent Nicolle Coyote System
38mLibraries for K/N citizens
39mDependencies and Kotlin/Native
46mKotlin/Anywhere
33mAdvanced Kotlin Native Integration
36mUsing Kotlin/JS and Kotlin/Native on Android
