rust-bindgen
rust-bindgen copied to clipboard
Take advantage of `feature(core_ffi_c)` (and possibly `feature(c_size_t)`)
feature(core_ffi_c) was stabilized (and possibly feature(c_size_t) in the future), so we may want to extend --use-core to use them (gated on --rust-target or some other flag).
In fact, it could potentially be made the default, since it would work for all projects (i.e. both std and no_std).
Currently, a workaround is to manually specify the prefix via --ctypes-prefix core::ffi.
Input C/C++ Header
void f(int);
Bindgen Invocation
$ bindgen input.h --use-core
Or in the future:
$ bindgen input.h
Actual Results
extern "C" {
pub fn f(arg1: ::std::os::raw::c_int);
}
Expected Results
extern "C" {
pub fn f(arg1: ::core::ffi::c_int);
}
Yes, making this the default based on the rust target seems like a great path forward. It seems core_ffi_c got stabilized already? A patch for this should be easy-ish to write / review :)
Yeah, I have piled up a few things for bindgen that I want to take a look at and submit -- I should have some time in a week or so :)