With kotlin native how do I include a created cint...
# kotlin-native
k
With kotlin native how do I include a created cinterop library with the final executable. Currently when I try to run the executable generated from my project it is looking for the .so file the corresponds to the library that I used the cinterop tool on, I would rather that this gets built into the final executable so that the end user does not have to install this dependency along with the project. I have already tried to use the staticLibrary option in the .def file
l
You'll need a static library to do that (.a instead of .so). Shared objects have to be on the linker path at runtime. Static libraries get built into the executable.
k
Okay I see. I am assuming that is a limitation of using the underlying compiler.
Thank you
l
That's just how ELF works. If you want it to be statically linked, you need libfoo.a
k
Sweet. I will recompile for that then
p
note that cinterop and commonize don't work on kotlin 1.8.20. use 1.8.21 or earlier. also, if you have any questions, you can look at how I statically link the library - https://github.com/Kotlin/multik/blob/develop/multik-openblas/cinterop/libmultik.def https://github.com/Kotlin/multik/blob/develop/multik-openblas/build.gradle.kts#L70