You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
varnicas 325c6bd1d9 Update 'README.md' 5 months ago
.vscode Final prototype, added README.md 5 months ago
C++ Final prototype, added README.md 5 months ago
node_modules First commit 7 months ago
README.md Update 'README.md' 5 months ago
index.html Final prototype, added README.md 5 months ago
index.js Final prototype, added README.md 5 months ago
package-lock.json First commit 7 months ago
package.json First commit 7 months ago

README.md

Prototype

Link for compiling code with Embind → https://emscripten.org/docs/porting/connecting_cpp_and_javascript/embind.html

Command for compiling code with Embind:

emcc -lembind -o test.js test.cpp -s NO_EXIT_RUNTIME=1 -s "EXPORTED_RUNTIME_METHODS=['ccall']"
  • EMSCRIPTEN_BINDINGS macro is used to bind the C++ function to make it callable from JavaScript

  • Emscripten compiles the C++ code to WebAssembly, generating a .wasm file and JavaScript glue code that loads the WebAssembly module and sets up the bindings

  • When the HTML page is loaded, test.js is executed, loading the WebAssembly module , Emscripten's Module object is created, exposing the C++ functions (like myFunction) to JavaScript

  • Example of using Module: var result = Module.myFunction(input)