4 ms·
The Rust bindgen tool automatically generates Rust FFI bindings to C and C++ libraries. Mozilla uses bindgen a lot to interoperate between Firefox's C++ and Rus
by cpeterso 7y ago
The Rust bindgen tool automatically generates Rust FFI bindings to C and C++ libraries. Mozilla uses bindgen a lot to interoperate between Firefox's C++ and Rust code. IIUC, Rust and C++ code can't seamlessly call each other unchanged, but bindgen adds FFI glue that makes it much easier.
https://github.com/rust-lang/rust-bindgen https://github.com/rust-lang/rust-bindgen
- marcosdumay 7y agoThe C++ on the documentation is there for the few places where there's nothing on the interface not supported by Rust. Notice it says it generates biding for "C (and some C++) libraries". A C interface on C++ code is how most people do interoperability with C++ libraries. It is pretty much C, so you can just use the FFI. But it's not really a C++ compatible FFI.