CxxInterop-tests
C++ FFI tests
An experimental test bed showing how C++ can talk to Rust, Swift, D, and Zig, so teams can gradually bring a newer language into an existing C++ codebase.
This repo is an experimental testing ground for making different programming languages talk to each other. Specifically, it explores how C++ can work alongside Rust, Swift, D, and Zig. It is not a finished application or a tool you would install. Instead, it is a collection of tests and examples showing that code written in one language can successfully communicate with code written in another.
In software development, teams often want to use a modern language like Rust or Swift while still relying on existing C++ code that has been built and refined over years. The challenge is that languages do not naturally understand each other. This project demonstrates a few ways to bridge that gap, allowing functions and data to pass between C++ and the other languages. The README links to several video presentations that walk through the design philosophy and practical examples of how these connections work.
This project would be useful for developers who are maintaining an older C++ codebase and want to gradually introduce a newer language without throwing away their existing work. For example, a team might want to rewrite parts of a system in Rust for better safety guarantees, or bring in Swift to modernize a database backend. The referenced videos show real-world scenarios, such as how Swift was integrated into FoundationDB to modernize its C++ foundation.
To actually run these tests, you need a fairly specific setup. The README lists requirements including a C++ compiler, CMake, and the toolchains for Swift, D, Rust, and Zig. The README does not go into detail about the specific test results or which interoperability method works best. It functions more as a resource hub, pointing to community talks and acknowledging the developers who contributed to the C++ and Rust connection examples.
Where it fits
- Learn how to call Rust functions from an existing C++ codebase
- See patterns for bringing Swift into a legacy C++ system
- Compare interop approaches across four languages before picking one
- Study real examples like Swift's integration into FoundationDB