awesome-repositories.com
Blog
MCP
awesome-repositories.com

Discover the best open-source repositories with AI-powered search.

ExploreCurated searchesOpen-source alternativesSelf-hosted softwareBlogSitemap
ProjectMCP serverAboutHow we rankPress
LegalPrivacyTerms
© 2026 Bringes Technology SRL·VAT RO45896025·hello@awesome-repositories.com
dtolnay avatar

dtolnay/cxx

0
View on GitHub↗
6,664 stars·396 forks·Rust·apache-2.0·22 viewscxx.rs↗

Cxx

CXX is a code generator that produces a safe, zero-overhead FFI bridge between Rust and C++. It lets functions and data types from either language be used directly in the other, with static type safety enforced at compile time and no copying, serialization, or runtime checks across the boundary.

The bridge supports the full range of cross-language interactions: Rust can call C++ functions and use C++ types, and C++ can call Rust functions and use Rust types. Standard library types like strings, vectors, and smart pointers are mapped automatically between the two languages, while opaque types and shared structs pass across the boundary with guaranteed ABI compatibility. Async functions, callbacks via function pointers, ownership transfers, and error propagation from Rust's Result to C++ exceptions are all handled natively.

CXX integrates with multiple build systems, including Cargo, CMake, Bazel, and Buck2, by generating C++ source and header files from Rust bridge declarations at compile time. A command-line tool is also available for use with other build pipelines.

Features

  • Rust-C++ FFI Generators - Generates zero-overhead, type-safe bindings that let Rust and C++ call each other directly.
  • Cross-Language Zero-Copy Passings - Passes standard library types like strings and vectors across FFI without serialization or copying.
  • Rust-C++ Type Mappings - Maps Rust standard types like String, Vec, and Box to C++ equivalents for seamless data exchange.
  • Zero-Cost FFI Generators - Generates bindings that enforce type safety and memory invariants at compile time with no runtime overhead.
  • C++ Function Invocations - Invokes C++ functions from Rust through a statically analyzed FFI bridge with full type safety.
  • Native Type Bridges - Passes Rust and C++ native types across the boundary without copying or serialization.
  • Cross-Language Ownership Transfers - Transfers strings, vectors, and other owned values across the language boundary using intuitive types.
  • C++ Language Bridges - Provides a toolkit for mapping C++ types and functions to Rust for safe cross-language calls.
  • Rust Bridges - Generates safe, zero-overhead FFI bindings that let Rust and C++ call each other directly.
  • Rust-C++ Bridges - Generates zero-overhead bindings that let idiomatic Rust and C++ code call each other directly.
  • Rust-C++ Data Bridges - Passes strings, vectors, smart pointers, and shared structs between Rust and C++ with automatic conversions.
  • Cross-Language Call Type Checking - Enforces static type safety for function calls between Rust and C++ at compile time.
  • Cross-Language Struct Sharings - Defines a struct visible to both Rust and C++ so it can be passed by value with matching memory layout.
  • Opaque Type Indirections - Manages C++ types with hidden layouts behind pointers and smart pointers for Rust interaction.
  • Static Type-Safe Bridges - Enforces type and memory safety across the language boundary using static analysis of function signatures.
  • C Function Bindings - Declares C++ function signatures in Rust and generates safe bindings without manual FFI glue.
  • C++ Function Bindings - Enables Rust code to call C++ functions safely through generated zero-overhead bindings.
  • Rust Function Bindings for C++ - Generates headers that let C++ code call Rust functions using native C++ types safely.
  • Rust-to-C++ Function Exposures - Exposes Rust functions to C++ code via generated headers for native invocation.
  • C++ Runtimes - Generates a safe FFI bridge for C++ code to call Rust functions with native C++ types.
  • C++ FFI Bridges - Generates safe, zero-overhead FFI bindings for calling C++ functions from Rust.
  • Cross-Language Ownership Transfers - Transfers ownership of heap-allocated objects across the boundary using Rust's UniquePtr and SharedPtr.
  • C++ Header and Source Generators - Produces C++ header and source files from Rust bridge definitions for cross-language calls.
  • Safe FFI Bridge Definitions - Declares shared interfaces between Rust and C++ using bridge modules that generate zero-overhead bindings.
  • Compile-Time Code Generation - Generates Rust and C++ FFI glue code at compile time from a shared bridge definition.
  • Cargo Build Scripts - Generates C++ bindings from Rust bridge declarations via a Cargo build script.
  • Zero-Cost FFI - Uses code generation to produce efficient bindings that enforce invariants from both languages at compile time.
  • Zero-Overhead - Generates code on both sides of the boundary that operates with no copying, serialization, or runtime checks.
  • Cross-Language Struct Bridges - Declares struct fields visible to both languages from a single source of truth, eliminating manual synchronization.
  • C++ Binding - Generates C++ bindings from Rust declarations by running a build script that compiles the resulting C++ source.
  • Build System Integration - Supports Cargo, CMake, Bazel, and Buck2 build systems for compiling Rust and C++ code together.
  • Build System Integrations - Supports multiple build systems by generating C++ source and headers from Rust bridge declarations.
  • FFI Declaration Generators - Replaces raw extern C declarations with richer, type-safe FFI interfaces between Rust and C++.
  • Cargo-CMake-Bazel Integrations - Integrates CXX code generation with Cargo, CMake, Bazel, and Buck2 build systems.
  • CMake Integrations - Links community-maintained CMake configurations that compile Rust and C++ code together in a single build system.
  • Opaque Pointer Handles - Passes types with hidden fields behind pointers or smart pointers across the language boundary.
  • Cross-Language Async Bridges - Provides a mechanism for bridging async functions between Rust and C++ via oneshot channels.
  • Rust-C++ Async Bridges - Bridges async functions between Rust and C++ using oneshot channels across the FFI boundary.
  • Rust-C++ Mappings - Maps key standard library types like strings, vectors, and smart pointers between Rust and C++ with idiomatic APIs.
  • Cross-Language Vec Transfers - Passes a Rust Vec to C++ code as a zero-overhead contiguous array for shared ownership and mutation.
  • Cross-Language String Bridges - Bridges Rust strings with C++ string types for safe string exchange across the language boundary.
  • Function-Pointer Callbacks - Transfers Rust closures as function pointers to C++ for callback-based event handling.
  • Ownership Transfer - Moves heap-allocated Rust objects into C++ ownership and back for safe async callbacks.
  • FFI Opaque Type Handles - Manages C++ types behind pointers so Rust can use them without knowing their layout.
  • Type Encapsulation - Transfers types with hidden fields across the boundary using indirection like Box or UniquePtr.
  • String Type Bindings - Binds C++ string types so Rust code can safely exchange string values across the language boundary.
  • Vector Type Bindings - Binds C++ vector types so Rust code can safely exchange array data across the language boundary.
  • Rust-C++ Type Mappings - Maps Rust types to their C++ equivalents automatically, providing idiomatic APIs on both sides.
  • Rust-C++ Standard Library Bridges - Provides built-in bindings for common types so they cross the Rust-C++ boundary with idiomatic APIs.
  • Cross-Language Primitive Mappings - Maps Rust primitives to C++ equivalents for direct use in shared FFI structs and signatures.
  • Cross-Language Container Bridges - Translates Rust containers to C++ equivalents for zero-copy data sharing across the boundary.
  • Cross-Language Smart Pointer Bridges - Maps Rust smart pointers to C++ equivalents for ownership-aware cross-language references.
  • Exception-to-Result Adapters - Converts Rust's Result type to C++ exceptions for idiomatic error propagation across FFI.
  • Result-to-Exception Adapters - Converts Rust's Result type to C++ exceptions for idiomatic error handling across the FFI boundary.
  • Foreign Function Interface - Safe interop between Rust and C++.

Star history

Star history chart for dtolnay/cxxStar history chart for dtolnay/cxx

How this analysis was created: This summary and feature list are AI-generated from collected project material and can contain mistakes. Stars, license and language are imported from GitHub. Inclusion does not mean that we have tested or audited this project. Check the source documentation for any feature you depend on. Learn more on our About page.

AI search

Explore more awesome repositories

Describe what you need in plain English — the AI ranks thousands of curated open-source projects by relevance.

Start searching with AI

Frequently asked questions

What does dtolnay/cxx do?

CXX is a code generator that produces a safe, zero-overhead FFI bridge between Rust and C++. It lets functions and data types from either language be used directly in the other, with static type safety enforced at compile time and no copying, serialization, or runtime checks across the boundary.

What are the main features of dtolnay/cxx?

The main features of dtolnay/cxx are: Rust-C++ FFI Generators, Cross-Language Zero-Copy Passings, Rust-C++ Type Mappings, Zero-Cost FFI Generators, C++ Function Invocations, Native Type Bridges, Cross-Language Ownership Transfers, C++ Language Bridges.

Which projects share features with dtolnay/cxx?

Projects with overlapping indexed features include: kdab/cxx-qt — CXX-Qt is a framework that connects Rust code with the Qt framework and QML interfaces through a bridging layer that… rust-lang/rust-bindgen — Rust-bindgen is a build-time foreign function interface binding generator and C header parser designed to automate… fzyzcjy/flutter_rust_bridge — flutter_rust_bridge is a code generation tool that automatically creates type‑safe Dart bindings for Rust functions,… rhaiscript/rhai — Rhai is an embedded scripting engine and dynamically typed language designed for integration into Rust applications.… crystal-lang/crystal — Crystal is a statically typed, compiled programming language designed for high performance and memory safety. It… nim-lang/nim — Nim is a statically typed, compiled systems programming language designed for high performance and cross-platform…

Projects sharing features with Cxx

These projects share indexed features with Cxx. Shared tags can include platform or build tooling; verify the primary use case before treating a result as a replacement.
  • kdab/cxx-qtKDAB avatar

    KDAB/cxx-qt

    1,501View on GitHub↗

    CXX-Qt is a framework that connects Rust code with the Qt framework and QML interfaces through a bridging layer that safely maps idioms between environments. It provides a macro-based system that defines QObject subclasses in Rust, exposing data and behavior directly to QML, JavaScript, and C++. The framework generates bidirectional bindings during compilation, transforming high-level Rust syntax declarations into companion C++ and Meta-Object Compiler files. It features cross-language type sharing, common data type adaptation for both Rust and Qt environments, and core utility interoperabil

    Rustqtqt5qt6
    View on GitHub↗1,501
  • rust-lang/rust-bindgenrust-lang avatar

    rust-lang/rust-bindgen

    5,212View on GitHub↗

    Rust-bindgen is a build-time foreign function interface binding generator and C header parser designed to automate cross-language interoperability. It functions as a tool to bridge Rust with C, C++, and Objective-C libraries by producing platform-specific declarations during the compilation process. The project distinguishes itself through its ability to handle complex C-family language constructs, including C++ inheritance and methods, as well as Objective-C classes and protocols. It ensures binary compatibility across different architectures by calculating target-aware memory layouts and va

    Rustbindingscodegenffi
    View on GitHub↗5,212
  • fzyzcjy/flutter_rust_bridgefzyzcjy avatar

    fzyzcjy/flutter_rust_bridge

    5,106View on GitHub↗

    flutterrustbridge is a code generation tool that automatically creates type‑safe Dart bindings for Rust functions, enabling direct cross‑language calls between Flutter and a Rust backend. It provides an async FFI adapter that transforms synchronous Rust functions into Dart async methods with background thread management, a cross‑language object manager that wraps persistent Rust structs as Dart objects preserving state across calls, and trait object interop that converts Rust traits into Dart abstract classes for seamless bidirectional use. The project handles the full lifecycle of integrat

    Dartbindgendartffi
    View on GitHub↗5,106
  • rhaiscript/rhairhaiscript avatar

    rhaiscript/rhai

    5,453View on GitHub↗

    Rhai is an embedded scripting engine and dynamically typed language designed for integration into Rust applications. It functions as an abstract syntax tree compiler and native interop layer, allowing developers to map Rust types and functions into a scripting environment for bidirectional communication. The project serves as a framework for creating customizable domain-specific languages. It allows for the definition of custom operators, syntax, and restricted execution environments, enabling the creation of specialized languages with tailored functional sets. The engine covers a broad rang

    Rustembeddedembedded-scripting-languageno-std
    View on GitHub↗5,453
  • Compare all 30 related projects→