Is it possible to pass function pointers from C++ (compiled into Javascript using Emscripten) to directly-written JS? I've found ways of creating function pointers of Javascript functions to pass to C++, but not a way of exposing a function pointer, given a value at runtime in C++ code, to Javascript.
Code-wide, what I'm after is to be able to complete the code snippet below in order to call the function passed as cFunctionPointer where I'm doing the console.log
void passToJs(void (*cFunctionPointer)()) {
EM_ASM_ARGS({
// Prints out an integer. Would like to be able to
// call the function it represents.
console.log($0);
}, cFunctionPointer);
}