Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Function to be reference by C/C++ via function pointer
- function func() {
- console.log("Hello world")
- return 3;
- }
- // Cannot register functions until Emscripten is initialized
- Module.onRuntimeInitialized = function()
- {
- // Get memory address of func()
- var funcPtr = addFunction(func, 'v');
- // Invoke C method that calls function pointer
- Module._callFuncPtr(funcPtr);
- };
Add Comment
Please, Sign In to add comment