-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Closed
Description
There are at least two code syntax regressions that occurred due to #12059 .
- Calling a wasm function pointer from either EM_ASM, EM_JS, JS library file or external JS code (--pre-js, --post-js or external JS/<script> in HTML file) via static binding
dynCall_sig(funcPtr, arg1, arg2, ...)
no longer works.
E.g.
a.c
#include <stdio.h>
#include <emscripten.h>
void foo(int param1, int param2)
{
printf("Received %d and %d\n", param1, param2);
}
typedef void (*fptr)(int, int);
EM_JS(int, callFunc2, (fptr funcPtr, int param1, int param2), {
dynCall_vii(funcPtr, param1, param2);
});
extern void callFunc(void (*foo)(int, int), int param1, int param2);
int main()
{
callFunc(foo, 42, 100);
callFunc2(foo, 42, 100);
EM_ASM({
dynCall_vii($0, $1, $2);
}, foo, 42, 100);
}
library_a.js
mergeInto(LibraryManager.library, {
callFunc: function(func, param1, param2) {
dynCall_vii(func, param1, param2);
}
});
emcc a.c --js-library library_a.js -o a.html
It looks like the intended replacement is the several orders of magnitude slower dynamic dynCall('sig', funcPtr, [arg1, arg2, ...]);
dispatch(?), but that is not good enough, and should not be used by anyone, unless they are really really in a polymorphic situation with their function pointer signature.
dynCall()
is currently not available in -s MINIMAL_RUNTIME=1
builds.
- Calling a wasm function pointer from JS library file via static binding
{{{ makeDynCall('sig') }}}(funcPtr, arg1, arg2, ...);
No longer works. Added test and fix for that in PR Fix regression that broke calls to makeDynCall in JS library code. #12732 .
Metadata
Metadata
Assignees
Labels
No labels