Stream: wasmtime

Topic: ✔ linking wasm components at runtime?


view this post on Zulip Natalie Klestrup Röijezon (Aug 06 2026 at 15:18):

the docs for component::LInker mention that:

This type is used to both link components together as well as supply host functionality to components.

but I don't actually see a way to register wasm components as libraries..
component::LinkerInstance lets me register host functions (func_*) and wasm _core_ modules (module), but there's nothing for components

component::bindgen! on my "main" component also gives me an add_to_linker function, but it also seems to assume that I want to register a host-provided component...

am I missing something obvious here? or is the expectation that you should precompose everything at build time already with wac?

view this post on Zulip Joel Dice (Aug 06 2026 at 15:27):

Indeed, Wasmtime does not yet support linking components together directly. You can either link them together indirectly by routing each import through a host function that calls an export or use wac to do it statically ahead of time (or just in time, according to your preference).

view this post on Zulip Natalie Klestrup Röijezon (Aug 06 2026 at 15:34):

ah right, I guess I could embed wac-graph.. doesn't feel cursed at all :'D

view this post on Zulip Natalie Klestrup Röijezon (Aug 06 2026 at 21:21):

to avoid xkcd979: @Bailey Hayes mentioned that wasmcloud does some similar wiring themself.. but I'm realizing that for my particular project I was overcomplicating things and should probably just stick to the single-component+host setup that wasmtime already supports (and that I should have done so whether or not wasmtime _did_ support multi-component linking)

view this post on Zulip Natalie Klestrup Röijezon (Aug 06 2026 at 21:24):

(thanks to the both of you for the explanation though!)

view this post on Zulip Notification Bot (Aug 06 2026 at 21:24):

Natalie Klestrup Röijezon has marked this topic as resolved.

view this post on Zulip Natalie Klestrup Röijezon (Aug 06 2026 at 21:58):

filed https://github.com/bytecodealliance/wasmtime/pull/14088 to maybe help someone else avoid the same escapade :sweat_smile:


Last updated: Aug 30 2026 at 09:07 UTC