Skip to content
This repository has been archived by the owner on Jun 4, 2023. It is now read-only.

stever/wasm-c-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

wasm-c-example

WebAssembly example using C using Emscripten.

Activate the Emscripten SDK:

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:

emcc hello.c -o hello.js
node hello.js

Optimise code, and emit HTML:

emcc hello.c -O3 -o hello.html

Serve via HTTP:

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.

About

WebAssembly example using C.

Topics

Resources

Stars

Watchers

Forks