Here is my C code:
#include <emscripten.h>
#ifdef __cplusplus
extern "C" {
#endif
EMSCRIPTEN_KEEPALIVE int add(int a, int b) {
return a + b;
}
#ifdef __cplusplus
}
#endif
I run it with such command: emcc -O3 add.c -s EXPORTED_FUNCTIONS=_add, it gave
me the wasm output which is close to what I want, but the name is mangled, the dumped output is something like below:
Type[2]:
- type[0] () -> nil
- type[1] (i32, i32) -> i32
Function[2]:
- func[0] sig=0 <b>
- func[1] sig=1 <c>
Table[1]:
- table[0] type=funcref initial=1 max=1
Memory[1]:
- memory[0] pages: initial=256 max=256
Export[4]:
- memory[0] -> "a"
- func[0] <b> -> "b"
- func[1] <c> -> "c"
- table[0] -> "d"
Code[2]:
- func[0] size=3 <b>
- func[1] size=7 <c>
Here c is the mangled add, is there any way to tell emcc to not mangle its name?