yamt opened issue #7592:
i have a preview1 reactor module, which exports
_initialize
.
when adapting it withwasi_snapshot_preview1.reactor.wasm
and loading the resulted component with wasmtime,
i expected the_initialize
export of the original module is somehow called during the component startup.
however, it doesn't seem to be called.
alexcrichton commented on issue #7592:
Currently the
*.reactor.wasm
adapter doesn't do anything with_initialize
, so you'll likely want to build your own adapter which calls it as part of thestart
function or implicitly as part of exports.Alternatively a convention could be built into
wit-component
to perhaps do this automatically but that would be pretty complicated implementation-wise since it would need to handle the fact that_initialize
is optional.
yamt commented on issue #7592:
Currently the
*.reactor.wasm
adapter doesn't do anything with_initialize
, so you'll likely want to build your own adapter which calls it as part of thestart
function or implicitly as part of exports.ok.
i put a hack in the (non-standard) entry point of my module and it's working well.Alternatively a convention could be built into
wit-component
to perhaps do this automatically but that would be pretty complicated implementation-wise since it would need to handle the fact that_initialize
is optional.i guess it's necessary for a reactor built with wasi-libc to work correctly.
alexcrichton commented on issue #7592:
Most of the usage of
_initialize
in wasi-libc for example has been pushed to lazy instead of eager initialization, which if possible is what I would recommend for other uses as well. Otherwise feel free to open an issue on the wasm-tools repository for a proposal about how to add_initialize
support towit-component
and adapters of course!
Last updated: Nov 22 2024 at 17:03 UTC