I'm still trying to prove that Rust can interface with our internal SDK and I manage to succeed on the C part. But some of the SDK is written in C++ and I'm trying to generate FFI with bindgen.
binding.rs is generated ok but I have this issue:
error[E0428]: the name `std_size_type` is defined multiple times
--> C:\Users\Geobomatic\Documents\CODE\rust\driver-primitives-sys\target\debug\build\driver-primitives-sys-7706057f8b57b49f\out/bindings.rs:228783:1
|
228782 | pub type std_size_type = size_type;
| ----------------------------------- previous definition of the type `std_size_type` here
228783 | pub type std_size_type = size_type;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `std_size_type` redefined here
|
= note: `std_size_type` must be defined only once in the type namespace of this module
I tried to opaque std::*
:
bindgen::Builder::default()
.header("wrapper.h")
.clang_arg("-I../PlatformSDK/CommonUtilities/Include")
.clang_arg("-x")
.clang_arg("c++")
.clang_arg("-std=c++14")
.opaque_type("std::*")
.opaque_type("size_type")
.generate()
.expect("Unable to generate bindings");
but I still got the error.
Did any body succeed generating a compilable bindings.rs from C++?
Otherwise I'll copy paste bindings.rs and fix it manually but I'd rather have an automated build.