mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-07 13:33:22 +00:00
ref https://forum.nim-lang.org/t/11338 ref https://github.com/beef331/wasm3/blob/master/src/wasm3/exporter.nim ref https://github.com/emscripten-core/emscripten/issues/6233 ref https://github.com/emscripten-core/emscripten/blob/3.1.56/system/include/emscripten/em_macros.h#L10 `EMSCRIPTEN_KEEPALIVE` is a macro that is used to prevent unused functions from being deadcode eliminated in emscripten, which is a simple wrapper around `__attribute__((used))`. This PR follows suits and expects dynlib is supposed to keep these functions alive. In the future, `exportwasm` might be introduced. After this PR, a function with `{.dynlib, exportc.}` can be reused from other wasm programs reliably.