Is it possible to combine another module into one instance later?
No, an instance is an instantiation of a single module. You can have two instances (one for each module) where one imports functions from another instance though.
can they share the same memory?
Yes, provided that at least one of the two imports the memory and you have built both wasm modules as PIC to ensure they can put their data at different addresses. I don't know exactly how you are supposed to instantiate a PIC wasm module though.
I want to simulate multiple DLLs to work in Wasm. Thanks.
For core Wasm, you might want to look at Emscripten's support for dynamic libraries (e.g. https://github.com/WebAssembly/tool-conventions/blob/main/DynamicLinking.md#implementation-status). The Component Model also supports composing shared libraries, and that's what componentize-py uses to generate components. componentize-py
composes libc.so, libpython312.so, etc. to generate components, and the plan is to optionally support importing those libraries from the host so they don't need to be bundled.
Last updated: Dec 23 2024 at 13:07 UTC