I want to generate C header from Rust code, and some recommend cbindgen. When continuing searching online and updating the code, I also found (and some people recommend) safer-ffi.
I notice that both of them look like can generate C headers with safer-ffi focus more on safe code, while cbindgen can produce both C and C++ headers.
Is this the only different part? Anything else? I am thinking to compare their features, and perhaps pick up one that might better fit my requirements.
Cbindgen requires you to implement the FFI interface yourself using extern "C", #[repr(C)] and almost certainly unsafe code and then once you have done that, it generates the C and C++ header files for you. It seems like safer-ffi on the other hand attempts to make implementing the FFI interface itself easier to do and reduce the amount of unsafe code you need. safer-ffi is more magic and considers itself to still be in alpha, while cbindgen may be harder to use.