rust-bindgen icon indicating copy to clipboard operation
rust-bindgen copied to clipboard

bindgen turns long int defined constants to u32 on 64-bit platform

Open moosterhof opened this issue 4 years ago • 1 comments

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.

moosterhof avatar Aug 18 '21 06:08 moosterhof

I think this is a duplicate of https://github.com/rust-lang/rust-bindgen/issues/923

moosterhof avatar Jan 18 '22 08:01 moosterhof

Indeed, closing it

pvdrz avatar Sep 19 '22 19:09 pvdrz