-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Add 'wasm_import_module' option to the @[Link] annotation #11935
Add 'wasm_import_module' option to the @[Link] annotation #11935
Conversation
2af59c7
to
711a9ce
Compare
This is entering new territory in multiple ways. So we need to carefully discuss the kind of change we want to make. |
I understand the need to discuss the solution, but in this case, I really don't see another way to implement this since this is the way Rust or Clang do it. This is a small change and we can discuss with a more concrete view of the impacts in mind, the discussion will probably be easier this way since, as you said, there isn't much experience with wasm from other contributors. I don't mind if the decision here is to implement it in an entirely different way, this doesn't have to be accepted just because it's done. I'll prefer opening issues on future occurrences. |
I added exporting all top-level |
…ame result, less code
Co-authored-by: Sijawusz Pur Rahnama <[email protected]>
Lib imports in WebAssembly have a "namespace" to them, such that identically-named symbols can be imported from different modules. By default, all C-like libraries expose their symbols on the
"env"
module, but there are some cases where it is needed to import from a module with a different name.For example, this is how to import WASI functions directly:
Likewise, Asyncify (needed for Fibers and GC) come from the
"asyncify"
module. This flag is only meaningful when targeting wasm and will be ignored on other targets.This is very similar to how Rust implements it: https://github.com/bytecodealliance/wasi/blob/984fa4fc17a074e8ea720cf319ad5e0357a991c7/src/lib_generated.rs#L2166
Additionally, all top-level
fun
functions are exported. For example: