Stream: wasmtime

Topic: ✔ Link two components at runtime


view this post on Zulip Jeff Charles (Jul 07 2025 at 15:17):

Is it possible to link two Wasm components at runtime with the wasmtime::component::Linker?

I have one component exporting one function and another component importing that function. I instantiate the component with the export in the linker and then try to instantiate the component importing that function but get an error message saying a matching implementation was not found in the linker. Is this supported without adding a hostcall implementation for the import that calls the export of the other component?

view this post on Zulip Alex Crichton (Jul 07 2025 at 15:23):

Not currently, no, it's required that the values travel through the host or that the component is composed ahead of time with tooling such as wac

view this post on Zulip Jeff Charles (Jul 07 2025 at 15:31):

For having the values travel through the host, is there an example you can point me to?

view this post on Zulip Alex Crichton (Jul 07 2025 at 15:33):

I don't have an exact example off-hand but one example would be to use func_new plus Func::call to funnel everything through component::Val. That may not be super efficient depending on the context though so if you know the types ahead of time you can use the typed versions of the APIs

view this post on Zulip Jeff Charles (Jul 07 2025 at 15:37):

I know the types involved so I'll use the typed APIs. Thanks for the help!

view this post on Zulip Notification Bot (Jul 07 2025 at 15:39):

Jeff Charles has marked this topic as resolved.


Last updated: Dec 06 2025 at 06:05 UTC