I'm trying to make a WebAssemly library module using emcc. To export a function from C into the calling JavaScript, the following syntax is used:
#include <emscripten.h>
EMSCRIPTEN_KEEPALIVE int triple(int n) {
return 3 * n;
}
How do I make the Nim compiler annotate {.exportc.}-ed functions like this?
wasmrt looks promising
Yes, but jsbind implements the EMSCRIPTEN_KEEPALIVE pragma you're looking for.
I'm getting a weird error:
True, nim has to be patched just a bit to not require -lm in a couple of places in stdlib.