-
Notifications
You must be signed in to change notification settings - Fork 101
Defining libc::c_char, c_long, etc. #238
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
Comments
You can use just The ARM Procedure Call Standard defines the mapping between C types and machine types in section 7.1.1. The size and alignment of machine types is defined in section 4.1. I think the only C type that has no fixed definition is |
I ended up stuck here (as far as I can understand it), after trying to do a C library -> bingden -> FFI -> lib crate workflow. Notably, libc will give you "nothing" if building for any Cortex-M, This is my attempt at a solution, and it does appear to work, insofar as I can build a bindgen ouput for a large embedded C library with libc as the only dependency: With the added note that my use of bingden required passing flags to steer it towards the expected target, i.e. |
With
thumbv6m_none_eabi
and similar targets, thelibc
crate does not compile becausec_char
,c_long
,c_ulong
, andwchar_t
are not defined. This is issue rust-lang/libc#375. We should fix this and add those definitions.gcc + newlib obviously have definitions for those types, but it looks like the
thumb*
targets in rustc are designed to not assume newlib. (Some std an libc code usecfg(target_env = "newlib")
, buttarget_env
is the empty string in eachsrc/librustc_target/spec/thumb*.rs
file in rustc.)Would
cfg(target_arch = "arm", target_os = "none")
be an appropriate filter to select targets that all have the same definition of these four types? What would that definition be?The text was updated successfully, but these errors were encountered: