Stream: git-wasmtime

Topic: wasmtime / issue #7592 who is supposed to call `_initiali...


view this post on Zulip Wasmtime GitHub notifications bot (Nov 28 2023 at 06:14):

yamt opened issue #7592:

i have a preview1 reactor module, which exports _initialize.
when adapting it with wasi_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.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 28 2023 at 15:08):

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 the start 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.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 29 2023 at 03:12):

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 the start 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.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 29 2023 at 16:28):

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 to wit-component and adapters of course!


Last updated: Dec 23 2024 at 12:05 UTC