Browse Source

Update 'README.md'

main
varnicas 5 months ago
parent
commit
325c6bd1d9
  1. 12
      README.md

12
README.md

@ -6,7 +6,11 @@ Link for compiling code with Embind → https://emscripten.org/docs/porting/conn
```
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)
- **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)
Loading…
Cancel
Save