https://github.com/jmsv/tryna-wasm
Just playing around with WebAssembly and stuff
https://github.com/jmsv/tryna-wasm
Last synced: 7 months ago
JSON representation
Just playing around with WebAssembly and stuff
- Host: GitHub
- URL: https://github.com/jmsv/tryna-wasm
- Owner: jmsv
- License: mit
- Created: 2019-04-26T14:24:34.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2019-04-26T14:25:13.000Z (about 7 years ago)
- Last Synced: 2024-12-29T17:33:33.292Z (over 1 year ago)
- Language: C
- Size: 1.95 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# tryna-wasm
Just playing around with WebAssembly and stuff
---
## Getting Started
At the moment this repo just contains a FizzBuzz C program, `hello.c`, with a minimal setup for running this from JavaScript via WASM.
1. Install Emscripten. Instructions at https://emscripten.org/docs/getting_started/downloads.html
2. Run `npm start` - this runs `npm run build` and then `node hello.build.js`
`package.json`'s `build` command runs `emcc hello.c -s WASM=1 -o hello.build.js` to compile `hello.c` to `hello.build.wasm` and create `hello.build.js`, which wraps the WebAssembly.
This `hello.build.js` file can also be used in a browser environment; change the build command to output html (e.g. `emcc hello.c -s WASM=1 -o hello.html`) and serve this file to try it out.