Skip to content

Running a component .wasm binary file #345

@cyraid

Description

@cyraid

The examples have Module.FromTextFile and such, and I have a .wasm file (binary) I tested with wasmtime and works, but using wasmtime-dotnet I and Module.FromFile I get:

Unhandled exception. Wasmtime.WasmtimeException: WebAssembly module 'WasmFile' is not valid: failed to parse WebAssembly module

Caused by:
    expected a WebAssembly module but was given a WebAssembly component
   at Wasmtime.Module.FromBytes(Engine engine, String name, ReadOnlySpan`1 bytes)
   at Wasmtime.Module.FromFile(Engine engine, String path)

I built the .wasm with componentize-dotnet. It looks like component support seems to be just coming up in the c-api, so we could take advantage of things like wasmtime_component_new, wasmtime_component_instance_get_func, wasmtime_component_func_call, wasmtime_component_linker_new, etc.

Since it seems like it's a new Linker, would you bundle it with the existing Linker and add a mode switch? Or make a whole new ComponentLinker for example?

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