afuentes / webassembly-quickstart

WebAssembly QuickStart

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

WebAssembly QuickStart

WebAssembly QuickStart Project

Enviroment MacOs

$ git clone https://github.com/emscripten-core/emsdk.git
$ cd emsdk
$ git pull
$ ./emsdk install latest
$ ./emsdk activate latest
$ source ./emsdk_env.sh
$ $ emcc -v
cache:INFO: generating system asset: is_vanilla.txt..
cache:INFO:  - ok
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 1.39.4
clang version 10.0.0 (/b/s/w/ir/cache/git/chromium.googlesource.com-external-github.com-llvm-llvm--project b5f295ffcec2fa7402e39eb1262acbd55a7d39f5)
Target: x86_64-apple-darwin17.7.0
Thread model: posix
InstalledDir: $HOME/emsdk/upstream/bin
shared:INFO: (Emscripten: Running sanity checks)

Start Project

$ git clone https://github.com/afuentes/webassembly-quickstart.git
$ cd webassembly-quickstart
$ emcc src/hello_world.c -o out/hello.html
$ ls out/
hello.html	hello.js	hello.wasm
$ cd out 
$ python -m SimpleHTTPServer 8080
Serving HTTP on 0.0.0.0 port 8080 ...

Note : Open browser in http://localhost:8080/hello.html

Page using Wasm Module

Reference

About

WebAssembly QuickStart

License:MIT License


Languages

Language:JavaScript 74.6%Language:HTML 24.9%Language:C++ 0.4%Language:C 0.1%