-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Proposal: one EXPORTS setting to rule them all #8380
Comments
Would the exported functions also lack the (I think this would be cleaner, but it does make backwards compatibility harder or bloatier.) |
sgtm, from a UX perspective at least |
Sounds good, assuming the distinction isn't needs by any of our users. @curiousdannii, I share your concern regarding maintaining backwards compat. For this kind of thing I'd like to see an eventual path to completely removal. In stages such as:
|
IIUC it does sort of repurpose the meaning of what an "export" is. We've been thinking of it in the sense of being exported from the compiled module, whereas the others would be actually imported into wasm but "exported" from the |
This issue has been automatically marked as stale because there has been no activity in the past year. It will be closed automatically if no further activity occurs in the next 7 days. Feel free to re-open at any time if this issue is still relevant. |
This still sounds like a good improvement if the details can be worked out. |
@curiousdannii Agreed, yeah. I think this has to wait on removing fastcomp first, after that this will be much easier to do. |
This issue has been automatically marked as stale because there has been no activity in the past year. It will be closed automatically if no further activity occurs in the next 30 days. Feel free to re-open at any time if this issue is still relevant. |
This would still be nice to have. |
In preparation for emscripten-core#8380
I'm actively work on this now! |
We only had two symbols in `legacyRuntimeElements` and it seems cleaner to handle these legacy aliases via the JS library system that we have for that. This helps with my work towards emscripten-core#8380
We only had two symbols in `legacyRuntimeElements` and it seems cleaner to handle these legacy aliases via the JS library system that we have for that. This helps with my work towards emscripten-core#8380
We only had two symbols in `legacyRuntimeElements` and it seems cleaner to handle these legacy aliases via the JS library system that we have for that. This helps with my work towards emscripten-core#8380
We only had two symbols in `legacyRuntimeElements` and it seems cleaner to handle these legacy aliases via the JS library system that we have for that. This helps with my work towards emscripten-core#8380
This helps with my work towards emscripten-core#8380
This helps with my work towards emscripten-core#8380
We only had two symbols in `legacyRuntimeElements` and it seems cleaner to handle these legacy aliases via the JS library system that we have for that. This helps with my work towards #8380
This helps with my work towards emscripten-core#8380
If possible, please remove the prefix of |
Yes, removing the underscore is indeed part of this change. It will go hand in hand. |
Why were exports prefixed in the first place? |
I believe is comes from windows and/or macOS where the C ABI includes a leading underscore on all C symbols. I guess whoever worked on this originally was probably a windows and/or macOS user. |
I thought it had more to do with the fact that back in the asm.js days there was the potential of naming conflicts between the asm-compiled part and the JS wrapper part... |
Not as far as I know. I don't see how the potential for naming conflict was any different back then. Native and JS symbols still occupy the same name space today. I think it just came from the fact that C compiler symbols on macOS/windows have/had leading underscores. IIUC it just seemed natural for native symbols to be named like that when @kripken and @juj were first working on fastcomp. |
Well if there was naming conflict, should we just prefix our library function with something like |
There are two types of JS library symbols:
In addition to these JS library symbols we also two other types of symbols in the JS world:
The only time we need to worry about symbol collision is if user explicitly exports a C symbol that happens to have the same name as a symbol of type (2), (3) or (4) above. I don't think this is going to be very common to be honest, and we don't have the ability to rename symbols of type (4) at all, so I'm inclined not to worry about it, and issue warnings/errors to users who try to export colliding symbols. |
Historically the reason we had prefixing had a few reasons that include the ones mentioned. The very first Emscripten translated LLVM IR text into JS, and I needed to handle name collisions between |
What is our progress on this? @sbc100 |
This change adds a new `-sEXPORT` setting that can by used to export any type of symbols (see emscripten-core#8380) It also includes a new `-sMANGLED_SYMBOLS` setting which default to true in order to not break backwards compatibility. Both these new settings are currently experimental and using `-sEXPORT` currently disables `-sMANGLED_SYMBOLS` by default.
I just uploaded the a draft PR: #22977 |
This change adds a new `-sEXPORT` setting that can by used to export any type of symbols (see emscripten-core#8380) It also includes a new `-sMANGLED_SYMBOLS` setting which default to true in order to not break backwards compatibility. Both these new settings are currently experimental and using `-sEXPORT` currently disables `-sMANGLED_SYMBOLS` by default.
This change adds a new `-sEXPORT` setting that can by used to export any type of symbols (see emscripten-core#8380) It also includes a new `-sMANGLED_SYMBOLS` setting which default to true in order to not break backwards compatibility. Both these new settings are currently experimental and using `-sEXPORT` currently disables `-sMANGLED_SYMBOLS` by default.
This change adds a new `-sEXPORT` setting that can by used to export any type of symbols (see emscripten-core#8380) It also includes a new `-sMANGLED_SYMBOLS` setting which default to true in order to not break backwards compatibility. Both these new settings are currently experimental and using `-sEXPORT` currently disables `-sMANGLED_SYMBOLS` by default.
This change adds a new `-sEXPORT` setting that can by used to export any type of symbols (see emscripten-core#8380) It also includes a new `-sMANGLED_SYMBOLS` setting which default to true in order to not break backwards compatibility. Both these new settings are currently experimental and using `-sEXPORT` currently disables `-sMANGLED_SYMBOLS` by default.
This change adds a new `-sEXPORT` setting that can by used to export any type of symbols (see emscripten-core#8380) It also includes a new `-sMANGLED_SYMBOLS` setting which default to true in order to not break backwards compatibility. Both these new settings are currently experimental and using `-sEXPORT` currently disables `-sMANGLED_SYMBOLS` by default.
Background: Right now to keep alive & export a compiled function one would use
EXPORTED_FUNCTIONS
, while to ensure a JS library function exists one would useDEFAULT_LIBRARY_FUNCS_TO_INCLUDE
, and there isEXPORTED_RUNTIME_METHODS
for exporting parts of the JS runtime. This is needlessly complex, and confusing since a C API may be implemented in either compiled code or a JS library, and currently you need to know which in order to properly include and export it.Proposal:
EXPORTS
setting, which receives a list of things to ensure exist and are exported in the final output. These can be in compiled code, the JS library, or the JS runtime - the user doesn't need to know.EXPORTED_FUNCTIONS
,DEFAULT_LIBRARY_FUNCS_TO_INCLUDE
,EXPORTED_RUNTIME_METHODS
._
prefixing, likeEXPORTED_RUNTIME_METHODS
etc., and unlikeEXPORTED_FUNCTIONS
. This moves us further along the path to get us rid of the old prefixing annoyance.For example,
-s EXPORTS=['main', 'emscripten_main_loop', 'AsciiToString']
would export a compiled function, a JS library function, and a runtime function, respectively (and note the lack of_
prefixes).Thoughts?
cc @juj @sbc100 @jgravelle-google @sbc100 @dschuff
The text was updated successfully, but these errors were encountered: