Skip to content

disable shorthash function name #3738

Answered by Liamolucko
czqasngit asked this question in Q&A
Discussion options

You must be logged in to vote

I don't think wasm-bindgen is really the tool for the job here: it's specifically for interoperating with JavaScript, not standalone Wasm runtimes like wasm3.

This is how you can write Wasm imports/exports directly without wasm-bindgen:

#[link(wasm_import_module = "foo")]
extern "C" {
    // These will compile down to `(import "foo" "alert" ...)` and
    // `(import "foo" "printf" ...)`.
    // The "foo" comes from `#[link(wasm_import_module)]`; if you don't specify
    // that, it defaults to "env".
    fn alert();
    fn printf();
}

// Unlike with `alert` and `printf`, the `extern "C"` isn't the bit of this
// which causes the function to be exported: it's `#[no_mangle]` that's doing
/…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by czqasngit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
3 participants
Converted from issue

This discussion was converted from issue #3736 on December 07, 2023 11:12.