CXX is a library that offers safe interop between Rust and C++. It provides a safe mechanism for calling C++ code from Rust and vice versa, one that is protected from the many possible things that can go wrong when bindgen or cbindgen is used to generate unsafe C-style bindings.

The general idea of CXX is to define the signatures of both sides of the FFI boundary embedded together in one Rust module. CXX gets a complete picture from this of the boundary, and through it is able to perform static analyses against the types and function signatures, ensuring that both Rust's and C++'s invariants and requirements are upheld. CXX then emits the relevant extern "C" signatures on both sides through a pair of code generators. This is done together with any necessary static assertions needed for later in the build process to verify correctness. The result is an FFI bridge that operates at zero or negligible overhead, with no copying, serialization or memory allocation needed.

Features

  • Shared structs
  • Opaque types
  • Functions are implemented and callable in either language
  • Many builtin types

Project Samples

Project Activity

See All Activity >

Categories

Libraries

License

MIT License, Apache License V2.0

Follow CXX

CXX Web Site

You Might Also Like
Achieve perfect load balancing with a flexible Open Source Load Balancer Icon
Achieve perfect load balancing with a flexible Open Source Load Balancer

Take advantage of Open Source Load Balancer to elevate your business security and IT infrastructure with a custom ADC Solution.

Boost application security and continuity with SKUDONET ADC, our Open Source Load Balancer, that maximizes IT infrastructure flexibility. Additionally, save up to $470 K per incident with AI and SKUDONET solutions, further enhancing your organization’s risk management and cost-efficiency strategies.
Rate This Project
Login To Rate This Project

User Reviews

Be the first to post a review of CXX!

Additional Project Details

Operating Systems

Linux, Mac, Windows

Programming Language

Rust

Related Categories

Rust Libraries

Registered

2020-11-09