You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am working on a rust wrapper for a c library and there is one place I have to go and manually edit the bindgen file after generation. The problem is a packed enum that is then used in a struct. Bindgen is tagging the enum with #[repr(i32)], but because it is a packed enum, it should be #[repr(u8)] or similar. This causes the struct which uses the enum to be too large on the rust side and cause a segfault when attempting to access the enum member of the struct.
I'm using rustified enums which work really well for my use case. after generation, I have to manually change the bindgen output file enum tag from repr(i32) to repr(u8) and I have to change the size of the struct from 88usize to 80usize and change the offset of the field from 80usize to 78usize
The text was updated successfully, but these errors were encountered:
I am working on a rust wrapper for a c library and there is one place I have to go and manually edit the bindgen file after generation. The problem is a packed enum that is then used in a struct. Bindgen is tagging the enum with
#[repr(i32)]
, but because it is a packed enum, it should be#[repr(u8)]
or similar. This causes the struct which uses the enum to be too large on the rust side and cause a segfault when attempting to access the enum member of the struct.compiling on windows
a simplified version of the c file:
I'm using rustified enums which work really well for my use case. after generation, I have to manually change the bindgen output file enum tag from repr(i32) to repr(u8) and I have to change the size of the struct from
88usize
to80usize
and change the offset of the field from80usize
to78usize
The text was updated successfully, but these errors were encountered: