Skip to content
New issue

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

How to compile code to run as Node app #185

Open
DragonOsman opened this issue Nov 15, 2018 · 0 comments
Open

How to compile code to run as Node app #185

DragonOsman opened this issue Nov 15, 2018 · 0 comments

Comments

@DragonOsman
Copy link

DragonOsman commented Nov 15, 2018

I want to compile the C++ code here to WebAssembly and use it in a Node app on the backend, rather than on the frontend since it's a webserver application. I'm reading this right now to try to make sure it's portable enough for WebAssembly (currently reading emscripten-runtime-environment.html ).

My question is: how do I use the WASM module I build in a Node application? Also, what file extension should I specify when giving a value to the -o flag? I'm already working on my compilation flag so I can just copy-paste it when compiling my code to WebAssembly, and right now I have this:

em++ -std=c++17 -Wall -pedantic -D variant_CONFIG_SELECT_VARIANT=variant_VARIANT_NONSTD -s WASM=1 -s DISABLE_EXCEPTION_CATCHING=0 -march=native -I C:/Jinja2Cpp/install_x64/include -I C:/json/single_include -I C:/boost_1_68_0/ currency_converter.cpp -L C:/Jinja2Cpp/install_x64/lib/static -ljinja2cpp -L C:/boost_1_68_0/lib64-msvc-14.1 -lboost_system -lpthread -o currency_converter.wasm --preload-file ../x64/Release/index.html --preload-file ../x64/Release/styles/styles.css ../x64/Release/scripts/scripts.js

Is this alright? Also, can someone point me to a free web host that would except a WebAssembly+Node app as the backend app?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant