learn-webassembly
learn-webassembly copied to clipboard
Need update for emscripten latest(1.38.0 above)
As #1 indicated, the examples of the master branch are not working with the emscripten 1.38.0 above. (For me, 1.38.30)
I made them work like below;
- Modify common/load-wasm.js as https://github.com/emscripten-core/emscripten/pull/7467 said.
- Specify emcc EXPORTED_FUNCTIONS option
https://emscripten.org/docs/porting/connecting_cpp_and_javascript/Interacting-with-code.html#calling-compiled-c-functions-from-javascript-using-ccall-cwrap
For chapter-05-create-load-module as instance,
emcc .\without-glue.c -Os -s WASM=1 -s SIDE_MODULE=1 -s BINARYEN_ASYNC_COMPILATION=0 -s EXPORTED_FUNCTIONS='["_init", "_setIsRunning", "_getIsRunning", "_updateRectLocation", "_moveRect"]' -s EXTRA_EXPORTED_RUNTIME_METHODS='["ccall", "cwrap"]' -o without-glue.wasm