Ryan Hunt's Blog

Tag: Ffi

Future directions for cbindgen (rust-ffi)

October 5, 2018 - rust ffi project

It’s been over a year since I first wrote about cbindgen. A lot has happened since then.

We’ve had a few new features added (tagged enums!), it’s seen some good use (25k all time downloads!), and there was a talk given at a rust berlin meetup!

This project started out as a quick fix for a problem we were facing at Mozilla. I thought others might find it useful so I open sourced it. It’s the first time I’ve ever ran an open source project, and I’ve learned a lot.

To this day, I’m continually surprised to see people using this tool and going through the effort to improve it. To everyone who’s helped out, thank you!

There is one issue I’d like to write about though.


Generating C bindings for Rust crates with cbindgen

August 30, 2017 - rust ffi project

Rust is a great language for doing tasks normally done in C/C++. While it has a minimal runtime and zero-cost abstractions, it also has guaranteed memory safety and high level language features that make programming easier.

Another neat thing about Rust is its ability to have a C FFI. Rust can be used to rewrite parts of an existing C/C++ application without having to rewrite the whole thing.

This means that you can get some of the benefits of Rust, without having to rewrite the whole world (which is often infeasible and tends to introduce new bugs).