@@ -16,9 +16,9 @@ For examples, `--cfg 'verbose'` or `--cfg 'feature="serde"'`. These correspond
16
16
to ` #[cfg(verbose)] ` and ` #[cfg(feature = "serde")] ` respectively.
17
17
18
18
## ` -L ` : add a directory to the library search path
19
+ <a id =" option-l-search-path " ></a >
19
20
20
- When looking for external crates or libraries, a directory passed to this flag
21
- will be searched.
21
+ The ` -L ` flag adds a path to search for external crates and libraries.
22
22
23
23
The kind of search path can optionally be specified with the form `-L
24
24
KIND=PATH` where ` KIND` may be one of:
@@ -231,15 +231,32 @@ This flag, when combined with other flags, makes them produce extra output.
231
231
232
232
## ` --extern ` : specify where an external library is located
233
233
234
- This flag allows you to pass the name and location of an external crate that
235
- will be linked into the crate you are building. This flag may be specified
236
- multiple times. This flag takes an argument with either of the following
237
- formats:
234
+ This flag allows you to pass the name and location for an external crate of a
235
+ direct dependency. Indirect dependencies (dependencies of dependencies) are
236
+ located using the [ ` -L ` flag] ( #option-l-search-path ) . The given crate name is
237
+ added to the [ extern prelude] , which is the same as specifying ` extern crate `
238
+ within the root module. The given crate name does not need to match the name
239
+ the library was built with.
240
+
241
+ This flag may be specified multiple times. This flag takes an argument with
242
+ either of the following formats:
238
243
239
244
* ` CRATENAME=PATH ` — Indicates the given crate is found at the given path.
240
245
* ` CRATENAME ` — Indicates the given crate may be found in the search path,
241
246
such as within the sysroot or via the ` -L ` flag.
242
247
248
+ The same crate name may be specified multiple times for different crate types.
249
+ For loading metadata, ` rlib ` takes precedence over ` rmeta ` , which takes
250
+ precedence over ` dylib ` . If both an ` rlib ` and ` dylib ` are found, an internal
251
+ algorithm is used to decide which to use for linking. The [ ` -C prefer-dynamic `
252
+ flag] [ prefer-dynamic ] may be used to influence which is used.
253
+
254
+ If the same crate name is specified with and without a path, the one with the
255
+ path is used and the pathless flag has no effect.
256
+
257
+ [ extern prelude ] : ../reference/items/extern-crates.html#extern-prelude
258
+ [ prefer-dynamic ] : codegen-options/index.md#prefer-dynamic
259
+
243
260
## ` --sysroot ` : Override the system root
244
261
245
262
The "sysroot" is where ` rustc ` looks for the crates that come with the Rust
0 commit comments