Kotlin calling .dll file

I have a function in fortran and a generated .dll from this code, I need to call it in my project. I can call it my kotlin Multiplatform project? I need to use this api with JavaFX and Swift (after generate .framework). Can I do it?


First of all, you can’t use JavaFX with Swift, they target two different platforms. Second, you can use platform binaries from both Kotlin-JVM and Kotlin-Native, but the mechanism is completely different. On JVM you have to use JNI (or higher level interfaces like JNA or JNR). On Native you can use direct native bindings.

1 Like

But not to use javaFX with Swift, I will use the same kotlin code with 2 different interfaces: JavaFX and Swift.

How can I use it directly? I have DLL only, do you have a doc or references to suggest me?

You should read documentation on Kotlin-Native. Like this one. Obviously, you can’t use windows dll on iOS, you need binaries build for that system.

1 Like