Skip to content

FFI unwind safety #1

Closed
Closed
@Mart-Bogdan

Description

@Mart-Bogdan

Hello, really nice article, but there is one important point!

According to Nomicon https://doc.rust-lang.org/nomicon/ffi.html#ffi-and-panics

A panic! across an FFI boundary is undefined behavior.

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,

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions