A simple example to create a WebAssemby code using C.
To compile, you must install Emscripten compiler.
cd ~/
git clone https://github.com/emscripten-core/emsdk.git
cd emsdk
./emsdk install latest
./emsdk activate latestAdd variables to PATH:
source ./emsdk_env.shTo compile the code:
emcc add.c -o add.jsThis will create two files: add.js and add.wasm.
Install the package http-server for the node application to be able to serve the html file:
npm install -g http-serverAnd start it:
http-serverNow, open the browser and access http://localhost:8080/add.html and you will see the page.
To know more details about it, check the article here.