Hi everyone,
I’m trying to load a WASI module compiled with WASI-SDK from a local wasm file, using examples from this repository. I can easily compile and load these examples without using stdlib, e.g. for ‘example1.c’:
addTwoInts = {
const buf = await FileAttachment("./example1.wasm").arrayBuffer();
// Create a WebAssembly instance from the wasm.
const res = await WebAssembly.instantiate(buf, {});
// Get the function to call.
const { addTwoInts } = res.instance.exports;
return(addTwoInts);
}
However, for more elaborate examples, I’d like to use libc. However, when I used modules compiled using WASI-SDK, I get the following error:
TypeError: WebAssembly.instantiate(): Import #0 module="env" error: module is not an object or function
Is there a WASI module loader that works in Observable with local wasm files?