From 3d0cb298d4cf2aaefe1cd879eb858eb9907e6214 Mon Sep 17 00:00:00 2001 From: Mads Marquart Date: Sat, 17 Feb 2024 05:00:58 +0100 Subject: [PATCH 1/2] Add note about static libraries not linking their dependencies --- src/linkage.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/linkage.md b/src/linkage.md index 82864b004..4864a49ee 100644 --- a/src/linkage.md +++ b/src/linkage.md @@ -44,8 +44,13 @@ be ignored in favor of only building the artifacts specified by command line. the local crate's code along with all upstream dependencies. This output type will create `*.a` files on Linux, macOS and Windows (MinGW), and `*.lib` files on Windows (MSVC). This format is recommended for use in situations such as - linking Rust code into an existing non-Rust application - because it will not have dynamic dependencies on other Rust code. + linking Rust code into an existing non-Rust application because it will not + have dynamic dependencies on other Rust code. + + Note that any dynamic dependencies that the static library may have (such as + dependencies on system libraries, or dependencies on Rust libraries that are + compiled as dynamic libraries) will have to be specified manually when + linking. The `--print=native-static-libs` flag may help with this. * `--crate-type=cdylib`, `#![crate_type = "cdylib"]` - A dynamic system library will be produced. This is used when compiling From 75661a46a2dd838452d1c44875b765d9fb019814 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Wed, 3 Jul 2024 22:33:01 +0000 Subject: [PATCH 2/2] Add clarification on linking Co-authored-by: Vadim Petrochenkov --- src/linkage.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/linkage.md b/src/linkage.md index 4864a49ee..3ac6bb255 100644 --- a/src/linkage.md +++ b/src/linkage.md @@ -50,7 +50,7 @@ be ignored in favor of only building the artifacts specified by command line. Note that any dynamic dependencies that the static library may have (such as dependencies on system libraries, or dependencies on Rust libraries that are compiled as dynamic libraries) will have to be specified manually when - linking. The `--print=native-static-libs` flag may help with this. + linking that static library from somewhere. The `--print=native-static-libs` flag may help with this. * `--crate-type=cdylib`, `#![crate_type = "cdylib"]` - A dynamic system library will be produced. This is used when compiling