Sargun Vohra
01/06/2025, 12:27 AMextern C
bindings to use via JNI on Kotlin/JVM and cinterop on Kotin/Native. However, I’m a bit lost when it comes to the gradle config for this, specifically with the jvm (desktop) target.
On Android, it’s easy; just set up externalNativeBuild
with cmake in gradle and System.loadLibrary("foo")
at runtime. The IDE even matches up external
declarations in Kotlin to their corresponding native headers.
On desktop JVM, how would I go about accomplishing the Gradle config? The general goal is to have gradle use cmake
to build my native sources and include the produced .dylib, .so, and .dll in my library’s jar artifact. I can then use a helper at runtime to extract that lib to a directory I can load from. The gradle tasks dependencies should be wired up so whatever task builds the JVM jar includes the library in its resources.Sargun Vohra
01/06/2025, 4:05 AMFrançois
01/06/2025, 7:07 AMSargun Vohra
01/06/2025, 4:30 PMZoff
01/09/2025, 9:12 AMnam
04/14/2025, 10:55 AM