Skip to content

Add option to allow dashes "-" in export names for WASM components #24413

Open
@peterhirn

Description

@peterhirn

Hi,

I'm experimenting with building WASM components with emscripten. I'm using wit-bindgen to generate C code from a wit file, then compile everything with emcc.

After that I run wasm-tools component new emcc-output.wasm -o component.wasm to create the component and finally wasmtime run --invoke 'error-message(-6)' component.wasm to run the code.

The problem is that WIT functions are kebab-case and this is currently not allowed in emscripten, see https://github.com/emscripten-core/emscripten/blob/main/tools/emscripten.py#L575

Using this .wit

world root {
  export error-message: func(error-code: s32) -> string;
}

produces the error

emcc: error: invalid export name: cabi_post_error-message

For testing I patched out the check and everything seems to be working. Maybe you could allow dashes in export names for STANDALONE_WASM or PURE_WASI?

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