Hi, 


I’m Trying to use shared libraries and looking at *the instructions* 
<https://github.com/kripken/emscripten/wiki/Linking> on MAIN_MODULE=1 and 
SIDE_MODULE=1. The basics seem to be woking, but the main module got much 
larger than expected. It jumped from 800k to 2.7 meg. So I’ll looking to 
determine If i am missing one of the options, or using in correctly.


I reduced it to a simple example  and tried to make a small *.js output 
file following the tips in the maximally minimal discussion thread 
<https://groups.google.com/forum/#!searchin/emscripten-discuss/maximally/emscripten-discuss/FWMrXIQNwCg/IWUTI3PdRYMJ>
 


#include <stdio.h>

int main()

{

    puts("hello world\n");

}


Building that program with no optimization yields about 360k. If the 
standard set of options for smaller builds is used that can shrink down to 
about 56k, roughly the size mentioned in the other thread.  This is the 
command line used:


emcc linktest.c -Os --memory-init-file 0 -s NO_FILESYSTEM=1 -s NO_BROWSER=1 
-o linktest.js


When adding -s MAIN_MODULE=1, the size bumped to 890k, (1.7meg it 
optimization is omitted). The side modules I want to build will have 
minimal need for standard libraries beyond what main uses  so I’d still 
like to still trip out most of the standard library. Looking at the the 
linktest.js file I can see that larger file has SDL, and many parts (all??) 
of the the standard C and C++ libraries.


I was able to get it a bit smaller  (790k) by setting the following 
environment variables. 


EMCC_FORCE_STDLIBS=libc

EMCC_ONLY_FORCED_STDLIBS=1

 

As a check I  also tried:


EMCC_FORCE_STDLIBS=1.


That bumped it to 3.7Meg, Well that pulled in the entire standard set (as 
expected),  the flags are having an effect.


So, is there a way to strip out unused symbol in the main module but still 
allow some dlopen() functionality?

Thank you,

Paul

-- 
You received this message because you are subscribed to the Google Groups 
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to