From C to Rust and back: The tutorial

Rust provides a seamless way to consume and provide a C-compatible ABI.
We'll explore the tools available and the best practices to convert C libraries to Rust and expose back a C-API matching the original.
We'll see what are the current limitations and if there are ways to overcome them.

Abstract

Rust provides a seamless way to consume and provide a C-compatible ABI.
We'll explore the tools available and the best practices to convert C libraries to Rust and expose back a C-API matching the original.
We'll see what are the current limitations and if there are ways to overcome them.

Rust and its ecosystem is maturing and lots of software is now proving that is possible to have implementations that are faster and safer than their C/C++/Python counterparts.

Lots of valid software still exists in other languages though, and providing easy ways to use the high performance Rust crates gets the best of both words.

During this tutorial we'll focus on C and see what tools and methods are available to:
- Build foreign code in Cargo;
- Generate bindings from C headers;
- Automatically convert C code in Rust;
- Generate C headers from a Rust C-API;
- Produce C libraries and related helpers (e.g. matching pkg-config files).

We'll see how some crates use those tools and try them out with simpler and more complex examples. As bonus track we'll see how generating bindings for C, wasm/Javascript and Python differ in ergonomics and philosophy.

Video

RustLab is a conference made by Develer.
Develer is a company based in Campi Bisenzio, near Florence. Our motto is : "Technology to give life to your products". We produce hardware and software to create exceptional products and to improve industrial processes and people's well being.
In Develer we have passion for the new technologies and we offer our clients effective solutions that are also efficient, simple and safe for the end users. We also believe in a friendly and welcoming environment where anybody can give their contribution. This passion and this vision are what we've been driven to organize our conference "made by developers for developers".

Subscribe to our newsletter

We hate spam just as much as you do, which is why we promise to only send you relevant communications. We respect your privacy and will never share your information with third parties.
©2025 RustLab | The international conference on Rust in Florence-Design & devCantiere Creativo-Made withDatoCMS