Hello, a Kotlin/Native question: is it possible to...
# kotlin-native
s
Hello, a Kotlin/Native question: is it possible to have a shared
.so
KN runtime? Under the hood, I see program.bc runtime.bc and hello.bc being combined and linked. Our project needs to generate a lot of shared libs for interop and runtime loading, and it quickly grows in size considering the same stuff being put into all of them. Ideally I'd look into generating a shared runtime and lightweight libraries that are dynamically linked to that. @olonho @svyatoslav.scherbina @jb.igor.chevdar thanks
o
Short answer is “no”. Longer one - support for that requires completely different approach than one taken in K/N. Libs we produce are self-contained, and do not produce “DLL hell” for end users. If indeed 200k per-library overhead is critical in your case, it may hint that granularity is too fine, and could be increased. Also patches to K/N runtime to avoid linking unneeded data are welcome, for example regex support is known to have potential problems in that area. I’d suggest to analyze produced binaries with tools like IDA or Online Disassembler and understand why excessive code or data linked into your shared objects. Size of mandatory part of K/N runtime is rather small, and shalln’t impact size much.
l
Glad to know K/N don’t plan to support dynamic linking! And I’d like to implement code shrinking by a simple tree-shake algorithm, maybe a Github PR latter~😀