HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
dtolnay
cxx
Rust2020–2024
dtolnay / cxx

cxx

Safe interop between Rust and C++

18Distinct people
22Mentions
0Explicit recommenders
6.9KGitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

Safe interop between Rust and C++

GitHub

Where it is used

No documented product use was verified in the last source check.

What people are saying

No recommendation phrase was found in the indexed comments.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

Mentioned in the same Hacker News threads. That is not proof they are substitutes.

This week on Hacker News

Nov 7–Nov 14 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/14/2026, 3:56:07 PM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by year22 dated mentions

Observed mentions: 2020-01-08 18:36:17 UTC to 2024-05-21 07:19:57 UTC.

0369122020-01-01 00:00:00 UTC to 2021-01-01 00:00:00 UTC (exclusive): 12 mentions; 1 submissions, 11 comments20202021-01-01 00:00:00 UTC to 2022-01-01 00:00:00 UTC (exclusive): 5 mentions; 2 submissions, 3 comments2022-01-01 00:00:00 UTC to 2023-01-01 00:00:00 UTC (exclusive): 2 mentions; 0 submissions, 2 comments20222023-01-01 00:00:00 UTC to 2024-01-01 00:00:00 UTC (exclusive): 2 mentions; 0 submissions, 2 comments2024-01-01 00:00:00 UTC to 2025-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2024

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
20202020-01-01 00:00:00 UTC2021-01-01 00:00:00 UTC12111
20212021-01-01 00:00:00 UTC2022-01-01 00:00:00 UTC523
20222022-01-01 00:00:00 UTC2023-01-01 00:00:00 UTC202
20232023-01-01 00:00:00 UTC2024-01-01 00:00:00 UTC202
20242024-01-01 00:00:00 UTC2025-01-01 00:00:00 UTC101

What Hacker News says

22 sources
> examples As it may be that people don't find them, the official ones are in `examples` https://github.com/facebook/buck2/tree/main/examples language examples in `examples/with_prelude` https://github.com/facebook/buck2/tree/main/examples/with_pr... There is a minmal Go example too: https://github.com/facebook/buck2/tree/main/examples/with_pr... More "real world" examples are dtolnay's CXX for Rust and C++ interop: https://github.com/dtolnay/cxx and my own ones (sorry to link these again, but I do not know of any others): C++ with Vcpkg: https://github.com/Release-Candidate/Cxx-Buck2-vcpkg-Example... C++ with Conan: https://github.com/Release-Candidate/Cxx-Buck2-Conan-Example... OCaml: https://github.com/Release-Candidate/OCaml-Buck-2-Examples
In Enlightenmentware
I have used CXX in a project where I had to use a library available only in C++. There were Python bindings but somehow they were very slow. I could have rolled out my own pybind11 but wanted some of the Rust guarantees. It was probably more convoluted than necessary since I also then exposed the Rust lib to Python, so C++ <=> Rust <=> Python , but it was indeed fun to implement it all. https://github.com/dtolnay/cxx
In Rust and C++ Interoperability
There are tools to automatically generate "safe" C++-Rust bindings (the intent being to restrict unsafety to trusting C++ code to be sound, without the risk of screwing up the bindings): https://github.com/dtolnay/cxx and https://cxx.rs/. However, creating bindings without typing out `unsafe` was a controversial issue, discussed at https://www.reddit.com/r/rust/comments/ielvxu/the_cxx_debate... . Also there are tools to automatically parse C++ headers and turn them into cxx bindings: https://github.com/google/autocxx and https://docs.rs/autocxx/
In The Rustonomicon
Making FFI calls to C is pretty easy and writing the FFI interface definitions can be completely automated with tools like bindgen [0]. Making FFI calls to C++ is a lot harder to do by hand, although cxx[1] is supposed to make doing so a lot easier as long as you can control the C++ end as well to be able to make it compatible with Rust Strings/Vectors/etc. [0] https://github.com/rust-lang/rust-bindgen [1] https://github.com/dtolnay/cxx
In Ask HN: Should I learn C/C++ or Rust as my first systems programming language?

Showing the 15 most recent of 22 sources. Enable JavaScript to search and browse every indexed mention.

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.