# dtolnay/cxx

Safe interop between Rust and C++

Repository: https://github.com/dtolnay/cxx
Canonical: https://ross.abutalabs.com/products/cxx
Homepage: https://cxx.rs
Language: Rust
License: Apache-2.0
License Family: permissive
Last push: 2026-08-25T04:14:20+00:00

## Health v2 (maintenance only)
Score: 94/100 (v2, computed 2026-09-03T02:39:23.370411+00:00)
- activity 99, release rhythm 84, longevity 100
- inputs: {"age_days": 2441, "days_push": 8, "days_rel": 25, "gap_med": 2.0, "n_releases_24m": 71}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 6810, forks 419 (observed 2026-08-28T04:09:48.769755+00:00)

## What it is
CXX is a Rust library providing a safe, statically analyzed foreign function interface between Rust and C++. It generates zero-overhead bridge code on both sides from a single shared description of the FFI boundary, with idiomatic bindings for standard library types.

## Use cases
- call C++ code from Rust safely
- expose Rust functions to a C++ application
- generate Rust bindings for a C++ library
- avoid unsafe C-style FFI bindings
- integrate Rust into an existing C++ codebase
- bridge Rust String and Vec with std::string and std::vector

## When to choose
- you need bidirectional Rust/C++ interop with memory safety guarantees
- you want zero-overhead FFI without serialization or copying
- you need idiomatic bindings for standard library types like unique_ptr and Box
- your build uses Cargo, Bazel, or Buck and you want generated bridge code

## When to avoid
- you only need bindings for C, not C++ (bindgen may suffice)
- you need to interop with languages other than C++
- your C++ code uses templates or features outside CXX's supported type regime

## Facets
- artifact type: library
- maturity: stable
- function: compiler, developer-tools, concurrency
- domain: developer-tools, programming-languages, cross-platform
- platform: rust, cpp, cross-platform
- tags: ffi, interop, code-generation, bindings, c-plus-plus, build-tool

## Member repositories
- dtolnay/cxx (main) score 94

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:09:48.769755+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-29T17:42:01.549117+00:00, confidence not recorded.
  - readme: https://github.com/dtolnay/cxx (fetched 2026-08-28T04:09:48.769755+00:00, sha 8d5395f82c70)
  - homepage: https://cxx.rs (fetched 2026-08-29T08:38:03.477818+00:00, sha 9dc7abcd0674)
  - registry_crates: https://crates.io/api/v1/crates/cxx (fetched 2026-08-29T08:38:03.486926+00:00, sha 3e8f051ce09e)
- Data as of 2026-08-30T08:39:29.467469+00:00.
