Skip to content

Question about export naming convention in core module #422

Closed
@tanishiking

Description

@tanishiking

Hi, I am working on adding support for standalone Wasm in Scala.js using WASIp2, and am planning to use wasm-tools to transform a core module into a component.

For reference, I’ve been playing around with the WAT representations of component binaries in Rust and moonbit.
And it turned out, it seems that to implement and export the run function for wasi:cli/[email protected] for example, the core Wasm binary must use an export name in the form of <interface>#<function name>. For example:

(export "wasi:cli/[email protected]#run" (func 41))

If the function is exported under any other name, the wasm-tools component new command fails with an error:

error: failed to encode a component from module

Caused by:
    0: failed to decode world from module
    1: module was not valid
    2: failed to find export of interface `wasi:cli/[email protected]` function `run`

Based on this, I assume that when implementing a core Wasm module for such interfaces, wasm-tools expects functions to be exported with the <interface>#<function name> naming convention.

  • Is this assumption about naming convention correct?
  • If so, is this naming convention (or specification?) documented anywhere?
    • Is it specific to wasm-tools?

Sorry if this issue should go to wasm-tools rather than here.

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