I need #![no_std] rust source. I suggest that use-core should help but now use-core produces lots of ::std:: code. If use-core isn't good for the goal maybe it's worth introducing another option?
There are two options: use-core and ctypes-prefix. I suspect that setting ctypes-prefix to libc should remove all the std code, otherwise it's a bug.
I'm processing a low-level library (CMSIS/STM32 HAL). And I get the output
full of ::std::os::raw::c_uint types. I suggest that they should be
replaced with libcore types. Possible?
Is core::os::raw a thing now? I was pretty sure that at the time this was implemented the only suitable solution for #![no_std] and ctypes was using libc.
FYI: the library is libc-independent. And I assume rs code should be alike.
Transforming ::std::os::raw::c_uint -> u32 is fine for me, but it seems
impossible with bindgen options, right?
But AFAIU uint isn't completely equal to u32 (arch-dependent), so the full
solution should take this into account too.
You can create a submodule in your crate as follows:
mod c_types {
type c_uint = u32;
// ...
}
And call bindgen with ctypes-prefix set to c_types.
I'm closing this because I'm not sure there's anything else I can do from bindgen.
Thanks for reporting!
Em, excuse me. But ::std::os::raw::c_uint -> u32could be done. Or am I
getting it wrong and you suggest it must be done with c_types
workaround/c_types crate?
Yes, I believe so, hardcoding types for a single platform isn't something that should happen on bindgen.
Most helpful comment
Yes, I believe so, hardcoding types for a single platform isn't something that should happen on bindgen.