From 1012eb02ba79ff50d25ac02a4bbf912b43ce7ad4 Mon Sep 17 00:00:00 2001 From: OccupyMars2025 <31559413+OccupyMars2025@users.noreply.github.com> Date: Mon, 8 May 2023 07:23:47 +0800 Subject: [PATCH] Update c-with-rust.md modify the description about "build.rs" --- src/interoperability/c-with-rust.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/interoperability/c-with-rust.md b/src/interoperability/c-with-rust.md index 6bec3bd8..9c56c6aa 100644 --- a/src/interoperability/c-with-rust.md +++ b/src/interoperability/c-with-rust.md @@ -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.