Skip to content

Commit 1985b21

Browse files
committed
added information about dynamic linking
1 parent f1db29c commit 1985b21

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

README.md

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

92+
# Dynamic Linking: Why It Doesn't Work
93+
94+
![Minimum Rust: 1.0](https://img.shields.io/badge/Minimum%20Rust%20Version-1.0-brightgreen.svg)
95+
96+
Some might suggest using `prefer-dynamic` for smaller binaries, but this approach has critical limitations:
97+
98+
- **No stable ABI** - binaries break between Rust versions
99+
- **Deployment complexity** - requires exact library matches
100+
- **Community consensus** - static linking preferred for reliability
101+
102+
Rust's design prioritizes static linking for good reasons. Use the proven techniques in this guide instead.
103+
More about it you can read in this [blog post](https://kivooeo.github.io/dynamic-linking-in-rustc/)
104+
92105
# Reduce Parallel Code Generation Units to Increase Optimization
93106

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

439452
#[global_allocator]
440453
static A: System = System;
441-
```
454+
```

0 commit comments

Comments
 (0)