Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do I import a host function #1383

Open
goldenratio opened this issue Apr 19, 2024 · 1 comment
Open

How do I import a host function #1383

goldenratio opened this issue Apr 19, 2024 · 1 comment

Comments

@goldenratio
Copy link

goldenratio commented Apr 19, 2024

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

@richardpringle
Copy link

What is that imports macro?

You have to use extern blocks.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants