summary refs log tree commit diff stats
path: root/compiler/modulepaths.nim
diff options
context:
space:
mode:
authorringabout <43030857+ringabout@users.noreply.github.com>2024-04-03 00:18:03 +0800
committerGitHub <noreply@github.com>2024-04-02 18:18:03 +0200
commita1602b0d852942e5649b50b1afc77f7c7cb4ad6c (patch)
tree0302957b10d5c77f1f0e9310aaac5a2f2caccf14 /compiler/modulepaths.nim
parent32fa7e2871f7e23a0b7ca056e8bb7f7f0e6cc6d1 (diff)
downloadNim-a1602b0d852942e5649b50b1afc77f7c7cb4ad6c.tar.gz
dynlib keeps exported functions alive in emscripten (#23469)
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.
Diffstat (limited to 'compiler/modulepaths.nim')
0 files changed, 0 insertions, 0 deletions