Ben Chuanlong Du's Blog

It is never too late to learn.

Foreign Language Integration in Rust

Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!

cc

cc is a build-time dependency for Cargo build scripts to assist in invoking the native C compiler to compile native C code into a static archive to be linked into Rust code.

cmake

cmake is a build dependency for running cmake to build a native library.

libc

libc Raw FFI bindings to platform libraries like libc. libc provides all of the definitions necessary to easily interoperate with C code (or "C-like" code) on each of the platforms that Rust supports. This includes type definitions (e.g. c_int), constants (e.g. EINVAL) as well as function headers (e.g. malloc).

C2Rust

C2Rust helps you migrate C99-compliant code to Rust. The translator (or transpiler), c2rust transpile, produces unsafe Rust code that closely mirrors the input C code. The primary goal of the translator is to preserve functionality; test suites should continue to pass after translation.

typeshare

Typeshare is the ultimate tool for synchronizing your type definitions between Rust and other languages for seamless FFI.

rust-bindgen

rust-bindgen automatically generates Rust FFI bindings to C (and some C++) libraries.

ritual

Ritual allows to use C++ libraries from Rust. It analyzes the C++ API of a library and generates a fully-featured crate that provides convenient (but still unsafe) access to this API.

rust-cpp

rust-cpp is a build tool & macro which enables you to write C++ code inline in your rust code.

crubit

crubit is a C++/Rust bidirectional interop tool.

autocxx

autocxx is a tool for calling C++ from Rust in a heavily automated, but safe, fashion.

inline-python

inline-python inlines Python code directly in your Rust code.

rust-cpython

libloading

libloading provides bindings around the platform's dynamic library loading primitives with greatly improved memory safety.

References

Comments