Possibility to embed Superpowered in emscripten build without exposing all Superpowered methods on WASM instance
petermlyon opened this issue · 2 comments
Hi,
I've been building a C++ -> WASM library using your provided superpowered.bc library.
I can't seem to avoid exporting all of the superpowered methods etc to the JS-accessible interface of the instantiated WASM code (under __functions__) when using your library. This means that the WASM binary contains the entire Superpowered library implementation, regardless of whether or not it is all used.
I'm guessing this is because all of the methods are decorated with EMSCRIPTEN_KEEPALIVE or similar during the build process of the .bc. I've asked on the emscripten GH but there don't seem to be any options to undo the effect of EMSCRIPTEN_KEEPALIVE downstream in the build process.
Do you have any suggestions of how this might be achieved? Or alternatively is it possible to get a build of superpowered (either .bc or .a) without having Superpowered:: namespace methods flagged with EMSCRIPTEN_KEEPALIVE.
I did try converting the .bc to .a using emar, as I thought this might strip the effect of the decoration, but the result of including it in my build was unchanged.
This is not urgent as it isn't blocking my development, but would be nice to have if it was possible to keep the binary and interface as compact as possible.
Peter
If we don't export those functions, then the .bc would contain nothing, because we compile it using Emscripten.
OK thanks