Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calling a JS function via the val API fails if compiled with -pthreads and linked with -O3 #22989

Open
bruno-j-nicoletti opened this issue Nov 22, 2024 · 0 comments
Labels

Comments

@bruno-j-nicoletti
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants