Skip to content

Autocxx

GitHub crates.io docs.rs

Note

Autocxx is looking for a new maintainer! Regular maintenance work involves occasionally merging upstream bindgen fixes into the autocxx-bindgen fork (or if you’re more ambitious, finish the work to unfork bindgen, which seems achievable and would greatly simplify everything) as well as keeping an eye on bug reports. If you use autocxx, please consider taking this on!

Note

As a new user, you might consider using cxx or crubit instead.

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 whilst generating interfaces automatically from existing C++ headers using a variant of bindgen. Think of autocxx as glue which plugs bindgen into cxx.

For full documentation, see the manual.

Overview

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.

About

Tool for safe ergonomic Rust/C++ interop driven from existing C++ headers

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages