Hi, I was trying to use dynamic linking using dlopen with emscripten compiler version 1.38.28 and encountered the following problem:
1. When I try to use vector in the SIDE_MODULE, it can't seem to find the new and delete operators in the Module variable. 2. The command I use to build main and side module are: em++ doubler.cpp -o doubler.wasm -s SIDE_MODULE=1 -O3 -s "EXPORTED_FUNCTIONS=['_doubler']" EMCC_FORCE_STDLIBS=1 em++ main.cpp -O3 -s WASM=1 -s MAIN_MODULE=2 -o dynlink.js -s "EXPORTED_FUNCTIONS=['_main', '_clock', '_tripler', '_printf', '_puts']" -s "DEFAULT_LIBRARY_FUNCS_TO_INCLUDE=['clock']" -s FORCE_FILESYSTEM=1 --pre-js prejs.js The prejs file here is there to use FS.createLazyFile to cause lazy loading of the side module. If I change the exported function list in main_module to `['_main', '_clock', '_tripler', '__Znwm', '__ZdlPv', '_printf', '_puts']` It starts to work. Notice that I had to add the mangled symbols of new and delete operator to export list. Also, once I did this, I didn't get any missing symbols related to the vector class itself. So, I have two questions: 1. Do we have to export C++ runtime functions like new, delete, or even c runtime methods like printf, puts for code to work? Is that expected? 2. Since there were no errors for vector related symbols, does that mean that vector is linked with the side_module? If I also use vector in main module, will there be effectively two copies of vector? In both side and main module? Thanks in advance! -- 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 emscripten-discuss+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/emscripten-discuss/5f2ad4c5-fc8e-45a3-afab-e340f91f09f5%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.