https://github.com/google/autocxx
Tool for safe ergonomic Rust/C++ interop driven from existing C++ headers
https://github.com/google/autocxx
bindgen cxx rust
Last synced: 2 months ago
JSON representation
Tool for safe ergonomic Rust/C++ interop driven from existing C++ headers
- Host: GitHub
- URL: https://github.com/google/autocxx
- Owner: google
- License: apache-2.0
- Created: 2020-08-13T05:16:10.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2025-03-05T08:17:58.000Z (4 months ago)
- Last Synced: 2025-05-07T08:02:30.985Z (2 months ago)
- Topics: bindgen, cxx, rust
- Language: Rust
- Homepage: https://docs.rs/autocxx
- Size: 7.77 MB
- Stars: 2,420
- Watchers: 37
- Forks: 159
- Open Issues: 115
-
Metadata Files:
- Readme: README.md
- License: LICENSE-APACHE
Awesome Lists containing this project
- stars - google/autocxx
- awesome-rust-list - Autocxx
- awesome-rust-list - Autocxx
README
# Autocxx
[](https://github.com/google/autocxx)
[](https://crates.io/crates/autocxx)
[](https://docs.rs/autocxx)This project is a tool for calling C++ from Rust in a heavily automated, but safe, fashion.
The intention is that it has all the fluent safety from [cxx](https://cxx.rs) whilst generating interfaces automatically from existing C++ headers using a variant of [bindgen](https://docs.rs/bindgen/latest/bindgen/). Think of autocxx as glue which plugs bindgen into cxx.
For full documentation, see [the manual](https://google.github.io/autocxx/).
# Overview
```rust,ignore
autocxx::include_cpp! {
#include "url/origin.h"
generate!("url::Origin")
safety!(unsafe_ffi)
}fn main() {
let o = ffi::url::Origin::CreateFromNormalizedTuple("https",
"google.com", 443);
let uri = o.Serialize();
println!("URI is {}", uri.to_str().unwrap());
}
```#### License and usage notes
This is not an officially supported Google product.
Licensed under either of Apache License, Version
2.0 or MIT license at your option.