rust-bindgen
rust-bindgen copied to clipboard
error[E0588]: packed type cannot transitively contain a `#[repr(align)]` type
Input C/C++ Header
typedef struct _IMAGE_TLS_DIRECTORY64 {
ULONGLONG StartAddressOfRawData;
ULONGLONG EndAddressOfRawData;
ULONGLONG AddressOfIndex; // PDWORD
ULONGLONG AddressOfCallBacks; // PIMAGE_TLS_CALLBACK *;
DWORD SizeOfZeroFill;
union {
DWORD Characteristics;
struct {
DWORD Reserved0 : 20;
DWORD Alignment : 4;
DWORD Reserved1 : 8;
} DUMMYSTRUCTNAME;
} DUMMYUNIONNAME;
} IMAGE_TLS_DIRECTORY64;
typedef IMAGE_TLS_DIRECTORY64 * PIMAGE_TLS_DIRECTORY64;cases
Bindgen Invocation
// Configure and generate bindings.
let bindings = bindgen::builder()
.header("../inc/libnet.h")
//.clang_arg("-x").clang_arg("c++")
.generate()
.expect("Couldn't write bindings!");
let out_path = PathBuf::from(env::var("OUT_DIR").unwrap());
// Write the generated bindings to an output file.
bindings
.write_to_file(out_path.join("bindings.rs"))
.expect("Couldn't write bindings!");
or
$ bindgen input.h --whatever --flags
Actual Results
error[E0588]: packed type cannot transitively contain a `#[repr(align)]` type
#[repr(C, packed(4))]
#[derive(Copy, Clone)]
pub struct _IMAGE_TLS_DIRECTORY64 {
pub StartAddressOfRawData: ULONGLONG,
pub EndAddressOfRawData: ULONGLONG,
pub AddressOfIndex: ULONGLONG,
pub AddressOfCallBacks: ULONGLONG,
pub SizeOfZeroFill: DWORD,
pub __bindgen_anon_1: _IMAGE_TLS_DIRECTORY64__bindgen_ty_1,
}
and/or
// Insert the (incorrect/buggy) generated bindings here
and/or
Insert compilation errors generated when compiling the bindings with rustc here
Expected Results
Any solution?