I’m bundling a static library in a Kotlin project ...
# kotlin-native
n
I’m bundling a static library in a Kotlin project with cinterop, then making a shared library out of it. I noticed that public symbols from my C code are also exported in the final binary. Is there any way to avoid that?
j
It's possible to tell the linker to hide symbols; but not sure on which level you want to do it, and what is the best for you. But in my project, I have this in by build.gradle.kts:
Copy code
freeCompilerArgs += listOf("-linker-options", "-S -x -exported_symbols_list " + file("libs/exported-symbols.list").toString())
"man ld" could help you to see the format of exported_symbols_list etc.
n
Thanks a lot Jan! That should do the job 🙏