yamt opened issue #7592:
i have a preview1 reactor module, which exports
_initialize.
when adapting it withwasi_snapshot_preview1.reactor.wasmand loading the resulted component with wasmtime,
i expected the_initializeexport 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.wasmadapter doesn't do anything with_initialize, so you'll likely want to build your own adapter which calls it as part of thestartfunction or implicitly as part of exports.Alternatively a convention could be built into
wit-componentto perhaps do this automatically but that would be pretty complicated implementation-wise since it would need to handle the fact that_initializeis optional.
yamt commented on issue #7592:
Currently the
*.reactor.wasmadapter doesn't do anything with_initialize, so you'll likely want to build your own adapter which calls it as part of thestartfunction 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-componentto perhaps do this automatically but that would be pretty complicated implementation-wise since it would need to handle the fact that_initializeis 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
_initializein 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_initializesupport towit-componentand adapters of course!
alexcrichton closed issue #7592:
i have a preview1 reactor module, which exports
_initialize.
when adapting it withwasi_snapshot_preview1.reactor.wasmand loading the resulted component with wasmtime,
i expected the_initializeexport of the original module is somehow called during the component startup.
however, it doesn't seem to be called.
alexcrichton commented on issue #7592:
I believe this is now handled, so closing.
Last updated: Dec 13 2025 at 19:03 UTC