Skip to content

ustropo/webassembly-c-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WebAssembly in C - Example

A simple example to create a WebAssemby code using C.

Environment setup

To compile, you must install Emscripten compiler.

cd ~/
git clone https://github.com/emscripten-core/emsdk.git
cd emsdk
./emsdk install latest
./emsdk activate latest

Add variables to PATH:

source ./emsdk_env.sh

Compiling

To compile the code:

emcc add.c -o add.js

This will create two files: add.js and add.wasm.

Serving

Install the package http-server for the node application to be able to serve the html file:

npm install -g http-server

And start it:

http-server

Now, open the browser and access http://localhost:8080/add.html and you will see the page.

More information

To know more details about it, check the article here.

About

Example code to create a WebAssembly App with C.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages