Skip to content

0.5.1

Compare
Choose a tag to compare
@dtolnay dtolnay released this 10 Oct 05:32
· 2455 commits to master since this release
0.5.1
52830f5
  • Enable functions to have a different name between Rust and C++ (#349)
    • Within cxx::bridge, write #[rust_name = "..."] or #[cxx_name = "..."] to make a change to either name of a function
    • In general many functions can have the same C++ name (due to overloading); every function must continue to have a unique Rust name
#[cxx::bridge]
mod ffi {
    extern "C++" {
        include!("path/to/header.h");

        #[cxx_name = "take"]
        fn take_int(i: i32);

        #[cxx_name = "take"] // different overload of the same name in C++
        fn take_str(s: &str);
    }
}