C→Rust, Beyond the Basics
About
Rewriting a C codebase in Rust isn’t a big bang: it’s a marathon, where you execute a series of small, deliberate steps. This workshop teaches you how to do it incrementally, based on hard-won lessons from migrating production C codebases over to Rust.
We’ll start with FFI fundamentals (repr(C), bindgen, cbindgen), move to writing correct extern “C” interfaces, then work through a 4-step module rewrite process: encapsulate, rewrite, bridge, swap. Along the way, we’ll cover the pitfalls (mixed allocators, string encoding, performance overhead) and some of the high-level strategies you can use when planning out a large-scale migration. There will be hands-on exercises at each stage.
Description
At the end of the workshop, participants will be able to:
- Set up bidirectional C/Rust FFI with appropriate tooling (bindgen, cbindgen)
- Write correct and ergonomic extern “C” functions
- Apply a systematic process to rewrite a C module in Rust
- Avoid common interoperability pitfalls
Prerequisites
Participants are expected to bring a laptop to work on hands-on exercises. You’ll receive instructions via email, ahead of the workshop, detailing what software has to be installed beforehand.