-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FFI-Safe Polymorphism article] unwind safety #36
Comments
Hehe, I was kinda lazy and didn't make the functions inside the |
Looking at the resolution in Michael-F-Bryan/thin-trait-objects#2, @Mart-Bogdan what do you think the best way to address exception safety (and my solution, poisoning) would be? Should I update the original article, or maybe make a follow-up, or maybe even quietly sweep it under the rug and pretend it never happened? The code and concepts required are non-trivial and more relevant to designing a sound foreign function interface than the concept of Thin Trait Objects, so I'd like to do it justice if I can. |
Hello, really nice article, but there is one important point!
According to Nomicon https://doc.rust-lang.org/nomicon/ffi.html#ffi-and-panics
I don't say that article should dig so deep, but please add Note/warning that in real use all functions that are called from FFI should use catch_unwind and report errors to native code in other way.
Taking into account that it could be used with any user-provided impls of Write, that is fairly possible to encounter panics.
P.S. Rust's catch unwind is fairly cheap and creates small overhead in case no panic actually happen,
The text was updated successfully, but these errors were encountered: