SHARE
TWEET

Untitled

quantumech Apr 22nd, 2019 15 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Function to be reference by C/C++ via function pointer
  2. function func() {
  3.     console.log("Hello world")
  4.     return 3;
  5. }
  6.  
  7. // Cannot register functions until Emscripten is initialized
  8. Module.onRuntimeInitialized = function()
  9. {
  10.     // Get memory address of func()
  11.     var funcPtr = addFunction(func, 'v');
  12.  
  13.     // Invoke C method that calls function pointer
  14.     Module._callFuncPtr(funcPtr);
  15. };
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top