-
Notifications
You must be signed in to change notification settings - Fork 3
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
Make WASM compilation an optional feature #26
Comments
Hmm that is an interesting problem that I didn't foresee. Thanks for working on a fix. Since the exported function doesn't do anything other than call |
Yes, it's a bit of an unexpected issue, and seemily a bit of a Rust complier limitation. I'm even importing your function with an alias: use titlecase::titlecase as gruber_titlecase; But the mere existence of the I don't think dropping thet |
I expect it would be fine with the |
Perhaps I'm not understanding what you are proposing. Whether the Rust code for it is laid out in a module or inlined into the top level lib or wherever you put it, at the end of the day you want this crate to be compilable to WASM. That's totally fine, but one way or another that means getting a |
I'm having some trouble compiling my decasify project to WASM. This is my first real go at setting up a WASM build, so I might be doing it wrong, but it seems the trouble is the
titlecase()
function I'm trying to export (decasify's version handling multiple locales not just English like this project's function of the same name) is a naming conflict with the one in this crate. It doesn't even matter what I name my function on the Rust side or that I'm importing this crate's function with an alias — even if I try to take some other unrelated function and send it to the JS side with a#[wasm_bindgen(js_name = titlecase)]
attribute macro it ends up producing a duplicate symbol that the linker can't work out.As best I can figure the issue is with this:
titlecase/Cargo.toml
Line 25 in 5f0fd8b
... and the related automatic export of a WASM function with the name
titlecase
even if my app doesn't import that function. Just the fact that my app is being target at WASM creates the conflict.This project seems to be unconditionally adding
#[wasm_bindgen]
attributes to functions as well if the compilation target is WASM. Instead of this would it be possible to add an optional feature to gate this so that it would be possible to inclnude this crate and link against it using rlib without wasm exports getting in the way?The text was updated successfully, but these errors were encountered: