|
|
@ -722,16 +722,19 @@ No `transmute` required!
|
|
|
|
## FFI and unwinding
|
|
|
|
## FFI and unwinding
|
|
|
|
|
|
|
|
|
|
|
|
It’s important to be mindful of unwinding when working with FFI. Each
|
|
|
|
It’s important to be mindful of unwinding when working with FFI. Each
|
|
|
|
non-`Rust` ABI comes in two variants, one with `-unwind` suffix and one without. If
|
|
|
|
ABI comes in two variants, one with `-unwind` suffix and one without (except
|
|
|
|
you expect Rust `panic`s or foreign (e.g. C++) exceptions to cross an FFI
|
|
|
|
the `Rust` ABI, which always permits unwinding).
|
|
|
|
boundary, that boundary must use the appropriate `-unwind` ABI string (note
|
|
|
|
|
|
|
|
that compiling with `panic=abort` will still cause `panic!` to immediately
|
|
|
|
|
|
|
|
abort the process, regardless of which ABI is specified by the function that
|
|
|
|
|
|
|
|
`panic`s).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
If you expect Rust `panic`s or foreign (e.g. C++) exceptions to cross an FFI
|
|
|
|
|
|
|
|
boundary, that boundary must use the appropriate `-unwind` ABI string.
|
|
|
|
Conversely, if you do not expect unwinding to cross an ABI boundary, use one of
|
|
|
|
Conversely, if you do not expect unwinding to cross an ABI boundary, use one of
|
|
|
|
the non-`unwind` ABI strings (other than `Rust`, which always permits
|
|
|
|
the non-`unwind` ABI strings.
|
|
|
|
unwinding). If an unwinding operation does encounter an ABI boundary that is
|
|
|
|
|
|
|
|
|
|
|
|
> Note: Compiling with `panic=abort` will still cause `panic!` to immediately
|
|
|
|
|
|
|
|
abort the process, regardless of which ABI is specified by the function that
|
|
|
|
|
|
|
|
`panic`s.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
If an unwinding operation does encounter an ABI boundary that is
|
|
|
|
not permitted to unwind, the behavior depends on the source of the unwinding
|
|
|
|
not permitted to unwind, the behavior depends on the source of the unwinding
|
|
|
|
(Rust `panic` or a foreign exception):
|
|
|
|
(Rust `panic` or a foreign exception):
|
|
|
|
|
|
|
|
|
|
|
|