I'm trying to call a JS function from C++ via the val API. If I compile with -pthread and link with any -O1, -O2 or -O3 it will fail as the function caller won't be registered on the JS side.
I get errors along the line of...
TypeError: caller is not a function
at __emval_call_method (/Users/bruno/Work/webbind/build/webBind.js:1089:24)
at wasm://wasm/00091682:wasm-function[508]:0x213b0
at Module._main (/Users/bruno/Work/webbind/build/webBind.js:1389:99)
at /Users/bruno/Work/webbind/build/webBind.js:1485:13
After some experimenting it looks like the function signature registration is not happening correctly. _emval_get_method_caller is being called on the C++ side, but apparently not being invoked on the JS side.
I have a small project that replicates the issue. Uncomment the line in CMakeLists.txt with add_compile_options(-pthread), rebuild and it will fail.
https://github.com/bruno-j-nicoletti/webbind
Possibly related to this older issue?
#15557
Any help appreciated.