Open 7Hazard opened 4 years ago
CAPI void alt_RotationLayout_CAPI_Free_Forward(struct alt_RotationLayout* ptr); typedef struct alt_RotationLayout { float roll; float pitch; float yaw; } alt_RotationLayout; CAPI void alt_RotationLayout_CAPI_Free(struct alt_RotationLayout* ptr);
let bindings = bindgen::Builder::default() .rustfmt_bindings(true) .layout_tests(false) .header(format!("./altv-capi-{}-static-{}/include/altv-capi-{}.h", kind, platform, kind)) .parse_callbacks(Box::new(bindgen::CargoCallbacks)) .generate() .expect("Unable to generate bindings"); bindings .write_to_file(format!("src/altv_{}.rs", kind)) .expect("Couldn't write bindings!");
/* automatically generated by rust-bindgen 0.54.1 */ pub const true_: u32 = 1; pub const false_: u32 = 0; pub const __bool_true_false_are_defined: u32 = 1; pub type nullptr_t = *mut ::std::os::raw::c_void; extern "C" { pub fn alt_RotationLayout_CAPI_Free_Forward(ptr: *mut alt_RotationLayout); } #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct alt_RotationLayout { pub roll: f32, pub pitch: f32, pub yaw: f32, } extern "C" { pub fn alt_RotationLayout_CAPI_Free(ptr: *mut alt_RotationLayout); } #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct alt_RotationLayout { pub _address: u8, }
No duplicate definitions (when using forward declared pointers).
/* automatically generated by rust-bindgen 0.54.1 */ pub const true_: u32 = 1; pub const false_: u32 = 0; pub const __bool_true_false_are_defined: u32 = 1; pub type nullptr_t = *mut ::std::os::raw::c_void; #[repr(C)] #[derive(Debug, Copy, Clone)] extern "C" { pub fn alt_RotationLayout_CAPI_Free_Forward(ptr: *mut alt_RotationLayout); } pub struct alt_RotationLayout { pub roll: f32, pub pitch: f32, pub yaw: f32, } extern "C" { pub fn alt_RotationLayout_CAPI_Free(ptr: *mut alt_RotationLayout); }
Isn't this somewhat related to https://github.com/rust-lang/rust-bindgen/issues/2227 ?
Input C/C++ Header
Bindgen Invocation
Actual Results
Expected Results
No duplicate definitions (when using forward declared pointers).