File tree Expand file tree Collapse file tree 2 files changed +12
-5
lines changed Expand file tree Collapse file tree 2 files changed +12
-5
lines changed Original file line number Diff line number Diff line change 63
63
* [ No stdlib] ( no-stdlib.md )
64
64
* [ Intrinsics] ( intrinsics.md )
65
65
* [ Lang items] ( lang-items.md )
66
- * [ Link args ] ( link-args .md)
66
+ * [ Advanced linking ] ( advanced-linking .md)
67
67
* [ Benchmark Tests] ( benchmark-tests.md )
68
68
* [ Box Syntax and Patterns] ( box-syntax-and-patterns.md )
69
69
* [ Slice Patterns] ( slice-patterns.md )
Original file line number Diff line number Diff line change 1
- % Link args
1
+ % Advanced Linking
2
2
3
- There is one other way to tell rustc how to customize linking, and that is via
3
+ The common cases of linking with Rust have been covered earlier in this book,
4
+ but supporting the range of linking possibilities made available by other
5
+ languages is important for Rust to achieve seamless interaction with native
6
+ libraries.
7
+
8
+ # Link args
9
+
10
+ There is one other way to tell ` rustc ` how to customize linking, and that is via
4
11
the ` link_args ` attribute. This attribute is applied to ` extern ` blocks and
5
12
specifies raw flags which need to get passed to the linker when producing an
6
13
artifact. An example usage would be:
@@ -14,9 +21,9 @@ extern {}
14
21
```
15
22
16
23
Note that this feature is currently hidden behind the ` feature(link_args) ` gate
17
- because this is not a sanctioned way of performing linking. Right now rustc
24
+ because this is not a sanctioned way of performing linking. Right now ` rustc `
18
25
shells out to the system linker, so it makes sense to provide extra command line
19
- arguments, but this will not always be the case. In the future rustc may use
26
+ arguments, but this will not always be the case. In the future ` rustc ` may use
20
27
LLVM directly to link native libraries, in which case ` link_args ` will have no
21
28
meaning.
22
29
You can’t perform that action at this time.
0 commit comments