Hi,
One thing I do with one of my projects is to have pretty much most code in shared libraries (as plugins) this makes the architecture cleaner and code be reloaded while not closing down the application. One issue right now is that a shared lib (Mac OS) tested is 1.5 MB with this code
#[no_mangle]
pub fn shared_fun() -> i32 {
42
}
And if you have 10 of them it’s 15 MB which is pretty much 15 copies of std lib in this case. If I compile it manually with rustc -C prefer-dynamic it ends up being 8.4k which is much nicer in size.
Now I wonder if there is a way to tell Cargo to prefer dynamic linking over static? Also when I try to load the shared lib with that has been compiled prefer dynamic my program exists with signal 11. I would assume it means that it can’t find the dynamic version of std lib or do I need to manually load it myself?
Cheers!