#Webassembly C with Javascript
##🚀 Start
yarn install
yarn start
https://wasdk.github.io/WasmFiddle/ Editor de c
emcc lib/demo.c -s WASM=1 -o public/demo.js
emcc lib/demo.c -s WASM=1 -o public/demo.html
emcc lib/demo.c -s WASM=1 -s SIDE_MODULE=1 -o public/demo.wasm
emcc lib/demo.c -s WASM=1 -O3 -o public/demo.js
--> this will include in the demo.js output file: --post-js public/ready.js
emcc lib/demo.c -s WASM=1 --post-js public/ready.js -O3 -o public/demo.js
--> this will include in the demo.js output file: --pre-js public/ready.js
emcc lib/demo.c -s WASM=1 --pre-js public/ready.js -O3 -o public/demo.js
int getNumber() {
return 22
}
Debemos poner explicitamente -s EXPORTED_FUNCTIONS="['_getNumber']"
separados por coma las funciones que serán utilizadas en javascript
emcc lib/demo.c -s WASM=1 -s EXPORTED_FUNCTIONS="['_getNumber']" --post-js public/ready.js -O3 -o public/demo.js
emcc lib/demo.c -s WASM=1 -s EXPORTED_FUNCTIONS="['_main','_getNumber']" --post-js public/ready.js -O3 -o public/demo.js
ccall('getNumber', 'number')
ccall('getNumber', 'number', ['number'], [33])