-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Problem when compiling code that has symbol collision with WASI API #22205
Comments
Yup, that does sounds like a reasonable request. The |
I managed to reproduce this without
The problem only seems to occur when the program itself tries to export the Does your use case require |
Thanks for the reply! In my usecase I will dynamically load extension wasm files (with What is the best way to proceed in this situation? Will the |
I think fixing this issue (native symbols conflicting with JS library symbols) is going to be hard to solve. To use |
Version of emscripten/emsdk:
3.1.62
Issue Description
Hi, I am trying to compile a project into wasm that has a function with name
proc_exit
It seems that
proc_exit
is a special WASI name that is part of the WASM POSIX API. Usually emscripten generates a JS wrapper for this function and exposes it to the underlying WASM that could have been compiled from C sources, for example. Then, both js and C code can call thisproc_exit
to exit the process.However, I run into a runtime error when my C code contains an unrelated function with name
proc_exit
. It seems emscripten sees the presence of my function with the same name and decides to not create the specialproc_exit
function to act as js-wasm/WASI bridge.I ran into this problem when compiling postgres, which has a function named
proc_exit
.My understanding is that emscripted could expose its WASI API function, regardless of existence of homonymous functions in the source project. To avoid name collisions, emscripten could generate special attributes to expose the WASI api functions under special prefix.
Please find minimal reproducing example of the issue below to compile and run make all .
I would expect to open
index.html
in the browser and not see any error, but I see an error:Import #15 "wasi_snapshot_preview1" "proc_exit": function import requires a callable
Does the issue make sense?
Is it a real problem or am I misunderstanding something?
What are your thoughts on the proposed solution?
Code
main.c
Makefile
The text was updated successfully, but these errors were encountered: