CXX – A library bridges Rust and C++

This page summarizes the projects mentioned and recommended in the original post on news.ycombinator.com

Our great sponsors
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • SaaSHub - Software Alternatives and Reviews
  • cxx

    Safe interop between Rust and C++

  • Crust

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

    WorkOS logo
  • swift

    The Swift Programming Language

  • Surprisingly, Swift can do C++ direct interop too, without writing any mappings/type definitions:

    https://forums.swift.org/t/swift-and-c-interoperability-work...

    https://github.com/apple/swift/blob/main/docs/CppInteroperab...

    https://github.com/apple/swift/blob/main/docs/CppInteroperab...

  • rust-bindgen

    Automatically generates Rust FFI bindings to C (and some C++) libraries.

  • bindgen[1] already exists to autogenerate a rust API from c headers. It's inherently unsafe because C code is inherently unsafe. In particular, there is no language constructs like destructors or constructors, so you can't naively create a C-based API that can prevent memory/resource leaks and use after free errors. While C++ does have the same issues as C with unsafe pointer semantics, it does have constructors, destructors, and other features that map almost perfectly with Rust's RAII-based resource management, making it pretty easy to generate a safe(ish) rust interface. In practice, it's pretty easy to create a safe rust API from a C library: use bindgen to create the low-level unsafe API, then create rust wrappers using the ad-hoc creation and descruction library functions to implement RAII.

    [1] https://rust-lang.github.io/rust-bindgen/

  • cxx-async

    Simple interoperability between C++ coroutines and asynchronous Rust

  • rust

    Empowering everyone to build reliable and efficient software.

  • rfcs

    RFCs for changes to Rust

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts