Skip to content

Commit 1fde43c

Browse files
authored
added information about dynamic linking
1 parent f1db29c commit 1fde43c

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,16 @@ Enable LTO in `Cargo.toml`:
8989
lto = true
9090
```
9191

92+
# Dynamic Linking
93+
94+
![Minimum Rust: 1.0](https://img.shields.io/badge/Minimum%20Rust%20Version-1.0-brightgreen.svg)
95+
96+
By default, the Rust compiler uses **static linking**, which includes all dependencies and crates directly within the final binary. While this makes the binary self-contained, it also significantly increases its size.
97+
98+
Alternatively, you can enable **dynamic linking**, which links to shared libraries at runtime. This can **drastically reduce** the size of your binary.
99+
100+
For more details, check out [this blog post](https://kivooeo.github.io/dynamic-linking-in-rustc/).
101+
92102
# Reduce Parallel Code Generation Units to Increase Optimization
93103

94104
[By default][cargo-profile], Cargo specifies 16 parallel codegen units for release builds.
@@ -438,4 +448,4 @@ use std::alloc::System;
438448

439449
#[global_allocator]
440450
static A: System = System;
441-
```
451+
```

0 commit comments

Comments
 (0)