Skip to content
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

Static and dynamic libraries #359

Open
oovm opened this issue May 16, 2024 · 1 comment
Open

Static and dynamic libraries #359

oovm opened this issue May 16, 2024 · 1 comment

Comments

@oovm
Copy link

oovm commented May 16, 2024

Is there a specification to mark whether a component model should be (as a suggestion) a static library or a dynamic library?

Assume lib.wasm is a library, app.wasm is an application, and depends on lib.wasm.

  • Static library means the product is only one file [app-final.wasm]
  • Dynamic library means the product is two files [app-final.wasm, lib.wasm]
    • Unless the user forces static linking of this library (similar to --static-link lib.wasm)

Motivation

Although dynamic linking hell is a very bad problem, I think limited dynamic linking helps reduce the overall size of the final executable file

I developed a command line tool legion.wasm, which automatically looks for legion-plugin.wasm when encountering unknown instructions.

The plugin needs to use some definitions of the original application, which makes the plugin even larger.

Therefore, I hope there is some convention to specify that some dependencies should be compiled as a shared library as a whole, This can effectively reduce the overall size.

@lukewagner
Copy link
Member

The Component Model mostly leaves all these options open to the producer toolchain, providing the raw linking primitives to allow the producer toolchain to precisely say what it wants. For example, check out this example, which I think avoids DLL hell while also sharing the appropriate amount of code, all unambiguously linked together via the C-M: https://github.com/WebAssembly/component-model/blob/main/design/mvp/examples/SharedEverythingDynamicLinking.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants