Have a look at EMSCRIPTEN_KEEPALIVE: 
https://emscripten.org/docs/api_reference/emscripten.h.html#c.EMSCRIPTEN_KEEPALIVE,
 
this prevents a C/C++ function from being removed even when it isn't 
referenced by other C/C++ code (normally this is used to call C functions 
from the JS side).

On Thursday, 2 May 2019 08:16:43 UTC+2, Duan Bing wrote:
>
> I declare an external function in C source file, but never used by the 
> code, then compile it to wasm by EMCC.   there is no doubt the external 
> function will be eliminated by the compiler.
>
> Is there any approach to keep this external function and then be compiled 
> to an import function in wasm? 
>
> The motivation to remain the external function is that I want to insert 
> some wasm code in the wasm file after it's generated.
>
> Thanks all!
>

-- 
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