From 4a367d6f9dd7c973bd624f5e38515b72dc3b3705 Mon Sep 17 00:00:00 2001 From: Alpi Tolvanen <54468172+tolvanea@users.noreply.github.com> Date: Mon, 19 Feb 2024 14:58:32 +0200 Subject: [PATCH] Mention the `bridges` builder in the book --- book/src/extern-c++.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/book/src/extern-c++.md b/book/src/extern-c++.md index 11ed7b54e..b82315099 100644 --- a/book/src/extern-c++.md +++ b/book/src/extern-c++.md @@ -220,6 +220,18 @@ pub mod ffi { } ``` +If there are multiple bridge blocks within a crate, you need to include them in `build.rs` with a `bridges` builder + +```rust,noplayground +// build.rs +fn main() { + cxx_build::bridges(["src/file1.rs", "src/file2.rs", ...]) + .file("src/file1.cc") + .file("src/file2.cc") + ... +} +``` + #### Integrating with bindgen-generated or handwritten unsafe bindings Handwritten `ExternType` impls make it possible to plug in a data structure