-
Notifications
You must be signed in to change notification settings - Fork 501
Function signature mismatch when targetting wasm32-unknown-emscripten #954
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
Comments
Well I tried compiling the C files as a normal Emscripten staticlib, and I'm still getting the same error. So this might not be a problem with cc-rs at all. |
On the C side, |
Thank you so much for that explanation, especially as it would've involved searching for my code to see the types involved. I had thought that using the recommended Rust way of opaque pointers would be able to handle anything C gave it, which it can when compiled to x86_64, but it's not actually the same API, so I was just lucky it worked in the x86_64 ABI. I'm going to try changing Edit: Well changing the Rust definition of DispatchRock to a union didn't help. I'll have to try an out parameter. Edit 2: Out parameters seems to work. :) |
That’s odd, a repr(C) union should be ABI-compatible. I’ll take a closer look later (I’ve been meaning to dive deeper into the remglk-rs code since you announced it, since I’d like to use it in a project of mine eventually) but it almost certainly won’t be a cc-rs issue. |
Oh! I didn't realise you were the Hanna from the forum! Small world haha. |
I have an exported Rust function:
Which is called from a support C function:
Everything works fine with on x86_64-unknown-linux-gnu, but now that I'm trying to target wasm32-unknown-emscripten I'm suddenly getting an error:
It's like it's turned the return into a second argument. #715 looks similar, but I'm not targeting wasm32-unknown-unknown.
Any ideas how to get this working?
The text was updated successfully, but these errors were encountered: