rust-bindgen
rust-bindgen copied to clipboard
bindgen turns long int defined constants to u32 on 64-bit platform
Input C/C++ Header
typedef unsigned long int CK_ULONG;
#define CKF_USER_PIN_TO_BE_CHANGED 0x00080000UL
Bindgen Invocation
$ bindgen test.h
Actual Results
/* automatically generated by rust-bindgen 0.58.1 */
pub const CKF_USER_PIN_TO_BE_CHANGED: u32 = 524288;
pub type CK_ULONG = ::std::os::raw::c_ulong;
Expected Results
The test is a minimal test case based on PKCS#11 headers. I'm running this on a an MacOS Intel 64-bit host. The problem is that the constant is cast to a u32, the type is cast to a u64. Expected results would be that both are cast to u64 on a 64-bit host.
I think this is a duplicate of https://github.com/rust-lang/rust-bindgen/issues/923
Indeed, closing it