-
Book Overview & Buying
-
Table Of Contents
The Rust Programming Handbook
By :
Rust is a powerful language for building new systems, but the reality of software development is that a vast amount of existing code, especially at the system level, is written in C (and C++, which often exposes a C-compatible interface).
Rewriting everything from scratch in Rust is often impractical or undesirable. This is where Rust’s Foreign Function Interface (FFI) capabilities become incredibly important.
The FFI allows your Rust code to call functions written in other languages (primarily C, or languages that can export a C Application Binary Interface (ABI)) and, conversely, allows code written in those languages to call your Rust functions.
Why would you need to interface with C code from Rust??
There are several compelling reasons: