Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/alwinsden/wasm_trials
Test run on WASM.
https://github.com/alwinsden/wasm_trials
Last synced: about 1 month ago
JSON representation
Test run on WASM.
- Host: GitHub
- URL: https://github.com/alwinsden/wasm_trials
- Owner: alwinsDen
- Created: 2024-03-05T06:57:43.000Z (10 months ago)
- Default Branch: master
- Last Pushed: 2024-03-22T05:04:13.000Z (9 months ago)
- Last Synced: 2024-04-17T20:11:10.984Z (9 months ago)
- Language: C++
- Homepage: https://wasm-trials.vercel.app
- Size: 1.13 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
## WASM Cookbook
### References
https://marcoselvatici.github.io/WASM_tutorial/
- Memory access keys: https://emscripten.org/docs/api_reference/preamble.js.html#type-accessors-for-the-memory-model
### WASM build Commands
```shell
emcc main.cpp h_test.cpp -o main.js -s WASM=1 -s EXTRA_EXPORTED_RUNTIME_METHODS='["cwrap"]'
```### Temporary build command with O2 level optimization
```shell
emcc main.cpp h_test.cpp -O2 -o main.js -s WASM=1 -s ALLOW_MEMORY_GROWTH=1 -s FORCE_FILESYSTEM=1 -s TOTAL_MEMORY=268435456 -s EXPORTED_FUNCTIONS='["_malloc"]' -s EXTRA_EXPORTED_RUNTIME_METHODS='["cwrap"]'
```### Commands
```shell
#Here _fib is the exported function.
emcc main.cpp -o main.js -s WASM=1 -s EXPORTED_FUNCTIONS='["_fib"]' -s EXTRA_EXPORTED_RUNTIME_METHODS='["cwrap"]'
``````shell
#This exports all the functions
emcc main.cpp -o main.js -s WASM=1 -s EXTRA_EXPORTED_RUNTIME_METHODS='["cwrap"]'
```