Interop

Why doing C/C++/Rust interop at all?

C and C++ are not memory safe.

You can do one-shot rewrites (probably with an LLM) but in many cases, it is not feasible without sacrificing quality (will expand it later), so we need incremental rewrites, or in some cases not rewriting some parts of code at all. So C/C++ code needs to interop with the Rust code.

Not all C/C++/Rust interop users are equal

Different users have different constraints on which compilers they can use, some users are tied to a single version of a C or C++ or Rust compiler, or they can't change their build system and have complex setup there. Some users may even need to support multiple toolchains, each imposing some restriction on the project. On the other hand, some users may be ok with whatever compiler and build system that is available and don't mind switching their toolchain for better interop experience. The more flexible users are about their compiler and build system, the more features the interop system can provide to them.

With that observation, we can put C/Rust and C++/Rust interop tools in an spectrum:

While these tools have some overlap in their use cases, I don't think a single tool can cover the whole spectrum. Hence, I'm involved in more than one tool in that list (CO2, Zngur, autozng, CO2++) to cover all C/C++/Rust interop users. Below, I will explain the subset of the tools which I think would cover everything.

The minimal tools covering the whole spectrum

Why not ai

a rust rewrite is a reimplementation, unless you want an unsafe translation reimplementation needs judgement, which LLMs miss currently