Let’s assume that we have a C interface we want to wrap for Rust
the direct equivalent of this would be
use libc::c_long; fn cfunction() -> c_long
Still, this leaks the
c_long type to the crate user and will require either a cast on his side or importing the
We could write
fn cfunction() -> i64
but the type will be 32-bit on a 32-bit Linux. We could use
fn cfunction() -> isize()
But then Windows will return a 32-bit integer and we will return a 64-bit one.
What is the recommended way to cope with those non-fixed-precision C types when writing wrappers for C functions?