Skip to content

Commit 0ee9a66

Browse files
authored
Merge pull request #1472 from madsmtm/help-usage-of-print-native-static-libs
Add note about static libraries not linking their dependencies
2 parents 15e0f7d + 75661a4 commit 0ee9a66

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/linkage.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,13 @@ be ignored in favor of only building the artifacts specified by command line.
4444
the local crate's code along with all upstream dependencies. This output type
4545
will create `*.a` files on Linux, macOS and Windows (MinGW), and `*.lib` files
4646
on Windows (MSVC). This format is recommended for use in situations such as
47-
linking Rust code into an existing non-Rust application
48-
because it will not have dynamic dependencies on other Rust code.
47+
linking Rust code into an existing non-Rust application because it will not
48+
have dynamic dependencies on other Rust code.
49+
50+
Note that any dynamic dependencies that the static library may have (such as
51+
dependencies on system libraries, or dependencies on Rust libraries that are
52+
compiled as dynamic libraries) will have to be specified manually when
53+
linking that static library from somewhere. The `--print=native-static-libs` flag may help with this.
4954

5055
* `--crate-type=cdylib`, `#![crate_type = "cdylib"]` - A dynamic system
5156
library will be produced. This is used when compiling

0 commit comments

Comments
 (0)