We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
git clone https://github.com/emscripten-core/emsdk.git
cd emsdk
.\emsdk.bat update
.\emsdk.bat install latest
.\emsdk.bat activate latest
.\emsdk_env.bat
emcc -v
git clone https:github.com/emscripten-core/emsdk.git
CD EMSDK
./emsdk update
./emsdk install latest
./emsdk activate latest
./emsdk_env.sh
emcc example.cpp -o example.js -s EXPORTED_FUNCTIONS="['_add']"
extern "C" {}
#include <stdio.h> extern "C" { int add(int a, int b) { return a + b; } } int main() { return 0; }
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <script> Module = {}; Module.onRuntimeInitialized = function () { const { add, main } = Module.asm; console.log(add(1, 2)); console.log(add(10, 2)); console.log(add(15, 2)); }; // fetch("./hello.wasm") // .then((response) => response.arrayBuffer()) // .then((bytes) => WebAssembly.instantiate(bytes)) // .then((results) => { // const { add } = results.instance.exports; // console.log(add(1, 2)); // }); </script> <script src="./example.js"></script> </head> <body></body> </html>
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Emscripten 安装
window
git clone https://github.com/emscripten-core/emsdk.git
cd emsdk
.\emsdk.bat update
.\emsdk.bat install latest
.\emsdk.bat activate latest
.\emsdk_env.bat
emcc -v
linux
git clone https:github.com/emscripten-core/emsdk.git
CD EMSDK
./emsdk update
./emsdk install latest
./emsdk activate latest
./emsdk_env.sh
emcc -v
将C/C++ 编译成wasm
extern "C" {}
参考
The text was updated successfully, but these errors were encountered: