WASM:

https://github.com/Hanks10100/wasm-examples/tree/master/simple

mkdir hello
cd hello
echo '#include <stdio.h>' > hello.c
echo 'int main(int argc, char ** argv) {' >> hello.c
echo 'printf("Hello, world!\n");' >> hello.c
echo '}' >> hello.c
emcc hello.c -s WASM=1 -o hello.html

printf '#include<iostream> \nint main() { std::cout<<"hello world"<<std::endl; return 0;}' > helloworld.cpp

docker run --rm -v $(pwd):/src trzeci/emscripten emcc helloworld.cpp -o helloworld.html

docker run --rm -v $(pwd):/src trzeci/emscripten emcc math.c -Os -s WASM=1 -s SIDE_MODULE=1 -o math.wasm

python3 -m http.server 8080 #此时打开localhost:8080即可看到相应页面

emcc math.c -Os -s WASM=1 -s SIDE_MODULE=1 -o math.wasm

https://github.com/Hanks10100/wasm-examples
https://blog.csdn.net/liuyan19891230/article/details/79144332
https://segmentfault.com/a/1190000008402872

05-08 08:22