Skip to content

export names as they are #3911

Answered by daxpedda
womeier asked this question in Q&A
Apr 1, 2024 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

I'm not aware of wasm-bindgen supporting this.
To circumvent wasm-bindgen you could just use Rust directly:

extern "C" {
    fn write_string(s: &str);
}

Obviously this has a lot of problems.

Why exactly do you need the imported name not to change?
The reason why wasm-bindgen generates a shim is because e.g. &str isn't FFI safe and isn't compatible with JS, so this function can't really be exposed through Wasm in the first place.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@womeier
Comment options

Answer selected by womeier
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
2 participants
Converted from issue

This discussion was converted from issue #3909 on April 02, 2024 08:18.