Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/interoperability/c-with-rust.md
Original file line number Diff line number Diff line change
@@ -127,7 +127,9 @@ In the simplest case of compiling a single C file as a dependency to a static li
```rust,ignore
fn main() {
cc::Build::new()
.file("foo.c")
.compile("libfoo.a");
.file("src/foo.c")
.compile("foo");
}
```

The `build.rs` is placed at the root of the package. Then `cargo build` will compile and execute it before the build of the package. A static archive named `libfoo.a` is generated and placed in the `target` directory.