simon-bourne opened issue #10932:
Hi,
I have some code that hosts a wasm module and is able to snapshot it (in a similar way to Wizer).
I'd love to be able to host the wasm module as a component using
wasmtime::component::bindgenon the host andwit-bindgen::generateon the guest. This makes communicating between the host and guest much easier and safer.The trouble is, for snapshotting I'm using various methods on
wasmtime::Instancethat don't seem to have equivalents in the component API. For example:
exportsget_globalget_memoryget_tableget_func(component::Funcis not enough as I need to callto_raw)For a component instantiated like the bindgen hello world example, I don't think there's any way to access the low level
wasmtime::Instance. Would it be possible to give access the globals, memories, tables and functions?
pchickey assigned fitzgen to issue #10932.
fitzgen commented on issue #10932:
Wasmtime will only give access to things that the module/component exports, it won't expose the module/component's implementation details.
Because components can only import and export component-level things, we intentionally don't expose any of the core-level implementation details.
You can look at the
component-initproject for an example of how to do Wizer-style instrumentation despite these constraints.
simon-bourne closed issue #10932:
Hi,
I have some code that hosts a wasm module and is able to snapshot it (in a similar way to Wizer).
I'd love to be able to host the wasm module as a component using
wasmtime::component::bindgenon the host andwit-bindgen::generateon the guest. This makes communicating between the host and guest much easier and safer.The trouble is, for snapshotting I'm using various methods on
wasmtime::Instancethat don't seem to have equivalents in the component API. For example:
exportsget_globalget_memoryget_tableget_func(component::Funcis not enough as I need to callto_raw)For a component instantiated like the bindgen hello world example, I don't think there's any way to access the low level
wasmtime::Instance. Would it be possible to give access the globals, memories, tables and functions?
simon-bourne commented on issue #10932:
Thanks for the quick reply! I wasn't aware of
component-init. It looks as though it just exports getters for the memory and globals. That gives me something to think about anyway.
Last updated: Dec 06 2025 at 06:05 UTC