-
-
Notifications
You must be signed in to change notification settings - Fork 107
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
record: Differentiate disguised vs pointer types #1530
Conversation
Disguised types are not pointers, they're just typedefs to a private struct, while pointer types are typedef to a pointer to a private struct. Generate the right code for each.
Thinking out loud, I'm curious if this would help out with mapping Vulkan types in |
Was this actually tested? it makes the gtk4-rs build fail with the following
|
I think the bindings were incorrect, in all of those cases, the interface struct is defined in private C headers, so I don't think they can be implemented outside of GTK+ itself,. |
Yes, the failures look correct. These are all interfaces that can't be implemented outside of GTK itself. |
Disguised types are not pointers, they're just typedefs to a private struct, while pointer types are typedef to a pointer to a private struct. Generate the right code for each.
In C, there are 2 types of "disguised" typdefs:
typedef struct _Blob *Blob
and
typedef struct _Blob Blob
In Gir files, they're both called "disguised", but the first kind also has the "pointer" property set. The current generator only knows about the pointer type.
Currently, it generates
pub type Blob = *mut _Blob;
But , it should do
pub type Blob = _Blob
for the non-pointer type.The effect of this bug is that the rest of the code gen will think that the type is a pointer to a pointer.
So it will generate functions with a signature of
fn func(*mut *mut blob)
instead offn func(*mut blob)