I am writing a library involving FFI (with C), which needs to pass to a foreign function a pointer to a Rust function, which may panic, and must ergo catch the panic at the boundary, jump over the foreign stack frame, and resume unwinding — if unwinding is enabled. I want this library to be useful either sans runtime, or with it.
Options which come to mind:
#[cfg]by panic strategy — to my knowledge no such
__rust_maybe_catch_panicwith weak linkage — no idea whether this would even work, and likely highly unstable
What is the reliable method to catch panic iff unwinding enabled?
For the curious: the library is of a text screen and scrollback buffer, e.g. for a terminal emulator, which may be useful for terminal emulators in both user- and kernel-space, thus my concern about the runtime.