Skip to content

Commit

Permalink
Merge pull request #1 from OccupyMars2025/modify-description-about-bu…
Browse files Browse the repository at this point in the history
…ild.rs

Update c-with-rust.md
  • Loading branch information
OccupyMars2025 authored May 7, 2023
2 parents 897fcf5 + 1012eb0 commit 69e3109
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/interoperability/c-with-rust.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

0 comments on commit 69e3109

Please sign in to comment.