Skip to content

WASM that runs in wasmtime will not run in the library #278

@williammortl

Description

@williammortl

Hello, I have a Rust hello world app:

fn main() {
    println!("Hello, world!");
}

I compile it:

cargo build --target wasm32-wasi

and can run it in wasmtime wasmtime run hello-world.wasm without issue. However, when I run it in my C# app:

// See https://aka.ms/new-console-template for more information
using Wasmtime;

var config = new Config();
config.WithWasmThreads(true);
using var engine = new Engine(config);

using var module = Module.FromFile(engine, "hello-world.wasm");

using var linker = new Linker(engine);
using var store = new Store(engine);

var instance = linker.Instantiate(store, module);
var run = instance.GetAction("run")!;
run();

and I get this error:

Wasmtime.WasmtimeException: 'unknown import: `wasi_snapshot_preview1::fd_write` has not been defined'

any thoughts?

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