3 ms·
Binary libraries are fully supported in Rust, via the C ABI. You can provide a higher-level interface via a wrapper crate. Meanwhile C++ is stuck with 'ABI st
by zozbot234 5y ago
Binary libraries are fully supported in Rust, via the C ABI. You can provide a higher-level interface via a wrapper crate. Meanwhile C++ is stuck with 'ABI stability' practices that prevent all sorts of otherwise desirable changes in C++ library code, because they would introduce breaks in binary compatibility.
- paavohtl 5y ago> Binary libraries are fully supported in Rust, via the C ABI. You can provide a higher-level interface via a wrapper crate. I've never seen this in the wild and to be honest, it seems massively inconvenient to write a library, create a C-compatible interface for it (meaning you lose out on most benefits of Rust's type system), and then write a wrapper for said C-like API to regain type/memory safety and abstraction power. The killer is that you lose the ability to use traits in the interface between, which idiomatic Rust heavily relies upon.
- pjmlp 5y agoThat isn't what I was mentioning, I don't want to write C ABIs to use Rust libraries. Those stability practices is what allows me to use Qt, VCL, MFC, .... without rebuilding the world every time I need to start something new with them. It also allows several companies to sell C and C++ libraries, that wouldn't have done otherwise.