https://github.com/stever/wasm-c-example
WebAssembly example using C.
https://github.com/stever/wasm-c-example
c example wasm
Last synced: 14 days ago
JSON representation
WebAssembly example using C.
- Host: GitHub
- URL: https://github.com/stever/wasm-c-example
- Owner: stever
- Created: 2023-01-21T13:36:39.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2023-01-21T21:06:33.000Z (about 3 years ago)
- Last Synced: 2023-03-21T04:35:31.648Z (almost 3 years ago)
- Topics: c, example, wasm
- Language: HTML
- Homepage:
- Size: 51.8 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# wasm-c-example
WebAssembly example using C using [Emscripten](https://emscripten.org/).
Activate the Emscripten SDK:
```bash
git clone https://github.com/emscripten-core/emsdk.git
cd emsdk
./emsdk install latest
./emsdk activate latest
source ./emsdk_env.sh # emcc command now on path
```
Recompiling the `hello.wasm` file:
```bash
emcc hello.c -o hello.js
node hello.js
```
Optimise code, and emit HTML:
```bash
emcc hello.c -O3 -o hello.html
```
Serve via HTTP:
```bash
python -m http.server 8000
```
View the output on http://127.0.0.1:8000/hello.html
Based on example provided by Aaron Turner and licensed under the
[Creative Commons Attribution 4.0 License](https://creativecommons.org/licenses/by/4.0/).