Skip to content

Wasmtime: Clarify the relationship between Linker and Instance #2580

@Ekleog

Description

@Ekleog

The below feature description is actually already implemented, so I repurposed that issue as a documentation issue, see the second message

Feature

Automatically call _initialize for reactors, maybe using a special function to create a reactor Module?

Benefit

Knowing one has to call _initialize is something that is not very documented (well… ok, currently nothing is very documented, but seeing as support for wasi reactors landed in rustc like two days ago it's not surprising… anyway my struggles are documented here: rust-lang/rust#79997 (comment))

Implementation

Maybe this would be better with a separate function? But I somehow feel like calling linker.instantiate(&module) automatically calling _initialize would make sense… or maybe add a mandatory argument so people must express the choice of whether they want their module to be initialized at instantiation time or not, and at least know they have to do it manually if they want not to?

Alternatives

Keep the statu quo, ie. let the user call _initialize manually. IMO that would require much more documentation about the topic, though it's definitely a possibility too.

Thank you for all you do on wasm and the surrounding ecosystem! ❤️

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions