emscripten::val - How to pass Function type as an argument?

21 views
Skip to first unread message

gerald-dotcom

unread,
May 21, 2020, 3:34:38 PM5/21/20
to emscripten-discuss
I have a JS function like this,

function foo(functionName){
  console
.log(typeof functionName);
}

My emscripten code looks like this, 


int call() {
emscripten::val Global = emscripten::val::global("window");
emscripten::val FunctionName = emscripten::val::global("window")["zoo"];
emscripten::val GetType = Global.call<emscripten::val>("foo", FunctionName);
};



However, the type that emscripten pass to Function foo is an Object not a reference to function

Question maybe vague. I somehow need to pass the right type. 

I tested this in Pure JS and it can differ functions and objects easily. 






Reply all
Reply to author
Forward
0 new messages