On 11/13/13 12:06 PM, Daniel Micay wrote:
It's completely possible to write safe bindings to a C++ library. The
process involves wrapping the whole thing with `extern "C"` functions
using catch blocks for any function possibly throwing an exception. Keep
in mind that libraries already have to do this to support usage from
most other languages, so it's a sunken cost.

If a library takes a callback, writing safe Rust bindings isn't going to
turn out well. Rust functions can fail, so the Rust API can't pass an
arbitrary function to the callback.

Yeah, this has been a concern for a while (years). Maybe we should have an unsafe "catch" just for this case, to allow turning a Rust failure into a C-style error code.

Patrick

_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to