-
Notifications
You must be signed in to change notification settings - Fork 698
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
Bindings for headers using rust-style integer aliases are awkward #2256
Comments
There's no guarantee that generally |
If someone is interested in tackling this (I might :p): We could fix this after #2254 is merged by adding a pass over the AST that looks for all the items like Alternatively, this could be done during code generation by searching all the rust-bindgen/src/codegen/mod.rs Lines 807 to 809 in ebb1ce9
|
sounds good to me, although that should probably be opt-in, I suppose many libraries have more meaningful type aliases than just making the names shorter Although maybe those aliases would best be generated as newtypes? No idea. |
Yeah I'm not sure if this should be a hard coded |
Multiple C projects, especially the really old, big ones which are going to be the kind that Rust wants to bind against, have customized their own I would like to be able to rewrite these to simply be While retaining these as semantic, obviously: So I would like a more general mechanism under user control that allows me to assert that a given C |
maybe something like this would fit your case of use? The main idea is that instead of using type int32 = core::ffi::c_int;
extern "C" {
fn foo() -> int32;
} to type int32 = i32;
extern "C" {
fn foo() -> int32;
} and, if extern "C" {
fn foo() -> i32;
} |
Input C/C++ Header
Bindgen Invocation
Actual Results
Expected Results
There doesn't appear to be an easy way for this to simply become:
As renaming via
ParseCallbacks
doesn't appear to work.It'd be highly unfortunate to have to hack around it like this:
The text was updated successfully, but these errors were encountered: