I'm writting a toy Rust lib for R plugins (mostly since the exist one, extendr_api, is slower than expected) and currently stuck at dealing with panic.
R have an unsafe function that could be regard as panic handler (libR_sys::Rf_error), but currently, libR_sys::Rf_error depends on std, thus I cannot bind it to #[panic_handler] directly.
Is there a better way to generate _sys crate without the dependency of std?
or, the only solution is writting an ugly macro that wrapping every function with std::panic::catch_unwind?
It's been a while since I've done this, so I'm going from pure memory, but are you passing bindgen the --use-core flag to tell it to use core instead of std? I also have vague recollections of needing to use the --ctypes-prefix flag to allow bindgen to find C FFI types outside std.