Skip to content

Commit 9ca0efe

Browse files
committed
Clean up language in linkage. Note about compiler specifiness
1 parent 191e1e4 commit 9ca0efe

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

src/linkage.md

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
# Linkage
22

3-
The Rust compiler supports various methods to link crates together both
3+
> Note: This section is described more in terms of the compiler than of
4+
> the language.
5+
6+
The compiler supports various methods to link crates together both
47
statically and dynamically. This section will explore the various methods to
5-
link Rust crates together, and more information about native libraries can be
8+
link crates together, and more information about native libraries can be
69
found in the [FFI section of the book][ffi].
710

811
[ffi]: ../book/ffi.html
@@ -35,7 +38,7 @@ be ignored in favor of only building the artifacts specified by command line.
3538

3639
* `--crate-type=staticlib`, `#[crate_type = "staticlib"]` - A static system
3740
library will be produced. This is different from other library outputs in that
38-
the Rust compiler will never attempt to link to `staticlib` outputs. The
41+
the compiler will never attempt to link to `staticlib` outputs. The
3942
purpose of this output type is to create a static library containing all of
4043
the local crate's code along with all upstream dependencies. The static
4144
library is actually a `*.a` archive on linux and osx and a `*.lib` file on
@@ -44,15 +47,15 @@ be ignored in favor of only building the artifacts specified by command line.
4447
dynamic dependencies on other Rust code.
4548

4649
* `--crate-type=cdylib`, `#[crate_type = "cdylib"]` - A dynamic system
47-
library will be produced. This is used when compiling Rust code as
50+
library will be produced. This is used when compiling
4851
a dynamic library to be loaded from another language. This output type will
4952
create `*.so` files on Linux, `*.dylib` files on macOS, and `*.dll` files on
5053
Windows.
5154

5255
* `--crate-type=rlib`, `#[crate_type = "rlib"]` - A "Rust library" file will be
5356
produced. This is used as an intermediate artifact and can be thought of as a
5457
"static Rust library". These `rlib` files, unlike `staticlib` files, are
55-
interpreted by the Rust compiler in future linkage. This essentially means
58+
interpreted by the compiler in future linkage. This essentially means
5659
that `rustc` will look for metadata in `rlib` files like it looks for metadata
5760
in dynamic libraries. This form of output is used to produce statically linked
5861
executables as well as `staticlib` outputs.
@@ -125,7 +128,7 @@ dependencies will be used:
125128

126129
In general, `--crate-type=bin` or `--crate-type=lib` should be sufficient for
127130
all compilation needs, and the other options are just available if more
128-
fine-grained control is desired over the output format of a Rust crate.
131+
fine-grained control is desired over the output format of a crate.
129132

130133
## Static and dynamic C runtimes
131134

@@ -206,3 +209,7 @@ a statically linked binary on MSVC you would execute:
206209
```ignore,notrust
207210
RUSTFLAGS='-C target-feature=+crt-static' cargo build --target x86_64-pc-windows-msvc
208211
```
212+
213+
214+
[configuration option]: conditional-compilation.html
215+
[procedural macros]: procedural-macros.html

0 commit comments

Comments
 (0)