I am getting an error when I try to load my wasm and js

22 views
Skip to first unread message

Shawn Riordan

unread,
Jan 20, 2020, 11:28:01 AM1/20/20
to emscripten-discuss
    1. I get this error when trying to load the module:

    2. BindingError {name: "BindingError", message: "No dynCall invoker for signature: ii", stack: "BindingError: No dynCall invoker for signature: ii…meCallbacks (http://localhost:8000/foo.js:1:7729)"}
    3. name: "BindingError"
    4. message: "No dynCall invoker for signature: ii"
    5. stack: "BindingError: No dynCall invoker for signature: ii↵ at BindingError.<anonymous> (http://localhost:8000/foo.js:1:12836)↵ at new BindingError (eval at createNamedFunction (http://localhost:8000/foo.js:1:12545), <anonymous>:4:34)↵ at throwBindingError (http://localhost:8000/foo.js:1:13277)↵ at embind__requireFunction (http://localhost:8000/foo.js:1:29330)↵ at __embind_register_class (http://localhost:8000/foo.js:1:30314)↵ at wasm-function[45]:0x2715↵ at wasm-function[88]:0x36a8↵ at Module.___wasm_call_ctors (http://localhost:8000/foo.js:1:46999)↵ at func (http://localhost:8000/foo.js:1:11692)↵ at callRuntimeCallbacks (http://localhost:8000/foo.js:1:7729)"

    6. my code is:

    7. #include <math.h>
      #include <emscripten.h>
      #include <emscripten/bind.h>
      #include <emscripten/html5.h>

      using namespace emscripten;

      class FOOWASMInterface
      {
      public:
         
      FOOWASMInterface() { }

         
      float bar(float value, bool up)
         
      {
           
      if(up)
               
      return ceil(value);
           
      else
               
      return floor(value);
         
      }
      };

      EMSCRIPTEN_BINDINGS
      (FOOModule) {
         class_
      <FOOWASMInterface>("FOOWASMInterface")
           
      .constructor<>()
           
      .function("bar", &FOOWASMInterface::bar)
           
      ;
      }


    8. and my compile instruction is:

    9. em++ -O3 -std=c++14 -s ERROR_ON_UNDEFINED_SYMBOLS=0 foo_bindings.cpp --bind -s WASM=1 -o foo.js

    10. and my javascript is:

    11. Module = {
         onRuntimeInitialized
      : function () {
            var FOOLib = new Module.FOOWASMInterface();

            var value = FOOLib.bar(5.4, true);
            console.log('5.4 ceil' + value);
            value = FOOLib.bar(5.4, false);
            console.log('5.4 floor' + value);
         }
      };


      What mistake am I making?
Reply all
Reply to author
Forward
0 new messages