Skip to content

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

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

Closed
moosterhof opened this issue Aug 18, 2021 · 2 comments
Closed

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

moosterhof opened this issue Aug 18, 2021 · 2 comments

Comments

@moosterhof
Copy link

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
Copy link
Author

I think this is a duplicate of #923

@pvdrz
Copy link
Contributor

pvdrz commented Sep 19, 2022

Indeed, closing it

@pvdrz pvdrz closed this as completed Sep 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants