wasm-pack icon indicating copy to clipboard operation
wasm-pack copied to clipboard

How do I import a host function

Open goldenratio opened this issue 1 year ago • 1 comments

I am using wasmtime, to run .wasm generated by wasm-pack

In wasmtime,

let import_object = imports! {
        "env" => {
            "get_counter" => get_counter_func,
            "add_to_counter" => add_to_counter_func,
        }
    };
    

How do I import these functions in my .wasm file. Sorry for this noob question, I couldn't find any doc in it

goldenratio avatar Apr 19 '24 08:04 goldenratio

What is that imports macro?

You have to use extern blocks.

I don't think this has anything to do with wasm-pack though

richardpringle avatar Aug 01 '24 11:08 richardpringle