Open
Description
Some of the examples are using the assert!
macro. This will panic and thus unwind. Unwinding across FFI boundaries however is undefined behavior and needs to be catched.
This can be solved either by:
- Build with
panic = "abort"
in cargo.toml - Use
std::panic::catch_unwind
to catch the unwinding before it hits FFI code - Same as 2. but made easier by using the macro
callback_guard!
from the glib crate
I prefer number 1 (better performance) as long as the library created does not actively use unwinding, for example by restarting paniced threads. Since unwinding is a very important topic when it comes to FFI I think there should be a chapter with pros and cons in the book.
Metadata
Metadata
Assignees
Labels
No labels