-
Notifications
You must be signed in to change notification settings - Fork 82
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
A question about "Libc" example in Explainer.md #74
Comments
Hi! Good question. Yes, when two core modules share memory, there does need to be some negotiation and that's not shown in the example. Fundamentally, this is an custom ABI choice made independently by each language toolchain. For example, one option is to say that all global data has to be dynamically allocated by calling |
thank you for explanaton.
are there any such conventions available right now? (for C, or any other languages) |
In the canonical ABI, it's "future work". Predating the component model by many years, the toolchain-conventions repo contains a dynamic linking doc that currently depends on support from an external loader (often implemented by JS using the JS API in the browser). What I think we'd like to do with the Canonical ABI is to map module imports (which are unsupported in the current PR) to canonical core imports. Based on this, the |
do you mean it's in the scope of canonical abi to provide some kind of replacement of |
In theory, yes. This is a fairly new idea, so it may have fundamental problems that I'm not aware of yet and there are a lot more details to work out. @sunfishcode may also have more thoughts here. |
Yeah, something liike |
Tentatively closing as the questions seem answered, but feel free to reopen with new questions. |
Hi, let me ask to re-open this topic because this feature(dynamic linking) will be essential for using Wasm for IoT to save the footprint size. (assume that there is a valuable wasm library that will be used from multiple wasm modules) Question
Simply saying, I want to know the specification of "parametric linking." |
"Parametric linking" is a term that we've invented to describe the collection of features in the component-model that allow more-flexible, more-composable linking of components and modules. Specifically, I consider "parametric linking" to include:
These features are described in Explainer.md/Binary.md and formalized in #101. They are also, iiuc, fully implemented in wasmtime and jco transpile. So all this covers the specification of "parametric linking". What's still partially missing, but in-progress, is the per-language tooling support for emitting shareable core modules and emitting components that import shareable core modules. IIUC, @dicej has done some impressive work on this in the context of Python, to make dynamic linking of Python extensions work by reusing the low-level DynamicLinking toolchain support used by Emscripten. But more work is required to add proper dynamic linking support to, e.g., wasi-sdk so that it's easy for everyone to do. I hope that helps, let me know if you have any more questions. |
Thank you for your comment.
I'm excited to use this feature in our IoT environment. |
i'm reading https://github.com/WebAssembly/component-model/blob/main/design/mvp/Explainer.md
namely, the example cited below.
if i read it correctly, in the example
libc
instance exports its memory andmain
instance imports it.my understanding is that in that case these modules (
Main
andLibc
) need to have some negotiation about howthe shared memory is used. (eg. where to put their string literals)
i couldn't find any mechanism for such a negotiation. is there something i'm missing?
The text was updated successfully, but these errors were encountered: