一、安装
https://developer.mozilla.org/en-US/docs/WebAssembly/C_to_wasm
https://emscripten.org/docs/getting_started/downloads.html
If you change the location of the SDK (e.g. take it to another computer on an USB), re-run the ./emsdk activate latest
and source ./emsdk_env.sh
commands.
二、编译
emcc -o hello-world.js -s WASM=1 -s EXPORTED_FUNCTIONS='["_HelloWorldFunction"]' hello-world.c
emcc -o hello-world.html -s WASM=1 -s EXPORTED_FUNCTIONS='["_HelloWorldFunction"]' hello-world.c
emcc -o hello-world.html -s STANDALONE_WASM -s WASM=1 -s EXPORTED_FUNCTIONS='["_HelloWorldFunction"]' hello-world.c