Skip to content

wasm-component generate components for modules with host function imports #2185

Open
@CharlieTap

Description

@CharlieTap

Say I have an existing module like this:

(module
  (import "env" "host_function" (func $host_function (result i32)))
  (func $call_host_function (result i32) call $host_function)
  (export "call_host_function" (func $call_host_function))
)

Running the component cli I get:

wasm-tools component new host_function.wasm -o host_function_component.wasm
error: failed to encode a component from module

Caused by:
    0: failed to decode world from module
    1: module was not valid
    2: module requires an import interface named `env`

The vast majority of imports are host functions and are not provided by other modules, in these cases using the type signature of the import it should be possible to generate any worlds/interfaces needed (like env in this case)?

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