-
Notifications
You must be signed in to change notification settings - Fork 707
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
Incorrect bindings generated for emscripten #947
Comments
Which clang version are you using? |
|
I need the actual You can get it with something like:
Which should output something like:
|
Looks like another case that clang is trying to add |
Interesting,
|
Going further things getting more interesting... For this header: struct Foo {
unsigned long derp;
};
unsigned char add(unsigned char a, unsigned char b); bindgen (invoked with this same default config as in first post) generates these bindings: /* automatically generated by rust-bindgen */
#[repr(C)]
#[derive(Debug, Copy)]
pub struct Foo {
pub derp: ::std::os::raw::c_ulong,
}
#[test]
fn bindgen_test_layout_Foo() {
assert_eq!(::std::mem::size_of::<Foo>() , 8usize , concat ! (
"Size of: " , stringify ! ( Foo ) ));
assert_eq! (::std::mem::align_of::<Foo>() , 8usize , concat ! (
"Alignment of " , stringify ! ( Foo ) ));
assert_eq! (unsafe {
& ( * ( 0 as * const Foo ) ) . derp as * const _ as usize } ,
0usize , concat ! (
"Alignment of field: " , stringify ! ( Foo ) , "::" ,
stringify ! ( derp ) ));
}
impl Clone for Foo {
fn clone(&self) -> Self { *self }
}
extern "C" {
#[link_name = "_add"]
pub fn add(a: ::std::os::raw::c_uchar, b: ::std::os::raw::c_uchar)
-> ::std::os::raw::c_uchar;
}
fails with the message
It seems to me different data model is used for generating these bindings. asmjs/wasm32 are both 32bit platforms, and I'm running on 64bit macOS machine. |
Yup, I don't love magic, but looks passing |
Input C/C++ Header
adder.h:
Bindgen Invocation
Actual Results
Generated bindings:
rustc/emcc fails with a message:
(full message)
Expected Results
Emscripten emits names without leading
_
:so I expect following bindings to be generated:
I created repository for this case: https://github.com/pepyakin/emcc-bindgen-repro
This can be workarounded with setting trust_clang_mangling to false.
The text was updated successfully, but these errors were encountered: