加压emsdk-portable.tar.gz
./emsdk install latest
./emsdk activate latest
source emsdk_env.sh
参考
中文
[url]http://www.ruanyifeng.com/blog/2017/09/asmjs_emscripten.html[/url]
英文
[url]https://kripken.github.io/mloc_emscripten_talk/cppcon.html#/[/url]
faq
[url]http://kripken.github.io/emscripten-site/docs/getting_started/FAQ.html[/url]
生成example4.js 和example4.html
python -m SimpleHTTPServer 8080
./emsdk install latest
./emsdk activate latest
source emsdk_env.sh
参考
中文
[url]http://www.ruanyifeng.com/blog/2017/09/asmjs_emscripten.html[/url]
英文
[url]https://kripken.github.io/mloc_emscripten_talk/cppcon.html#/[/url]
faq
[url]http://kripken.github.io/emscripten-site/docs/getting_started/FAQ.html[/url]
#include <emscripten.h>
extern "C" {
double SquareVal(double val) {
return val * val;
}
}
int main() {
EM_ASM({
SquareVal = Module.cwrap('SquareVal', 'number', ['number']);
var x = 12.5;
alert('Computing: ' + x + ' * ' + x + ' = ' + SquareVal(x));
});
}
emcc -s EXPORTED_FUNCTIONS="['_SquareVal', '_main']" -s EXTRA_EXPORTED_RUNTIME_METHODS="['cwrap']" example4.cc -o example4.html
生成example4.js 和example4.html
python -m SimpleHTTPServer 8080