From 1fde43ce3daaf584a130553a86be88fc99b37863 Mon Sep 17 00:00:00 2001 From: Kivooeo <75776246+Kivooeo@users.noreply.github.com> Date: Mon, 5 May 2025 15:25:30 -0700 Subject: [PATCH] added information about dynamic linking --- README.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 0995488..057f2dc 100644 --- a/README.md +++ b/README.md @@ -89,6 +89,16 @@ Enable LTO in `Cargo.toml`: lto = true ``` +# Dynamic Linking + +![Minimum Rust: 1.0](https://img.shields.io/badge/Minimum%20Rust%20Version-1.0-brightgreen.svg) + +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. + +Alternatively, you can enable **dynamic linking**, which links to shared libraries at runtime. This can **drastically reduce** the size of your binary. + +For more details, check out [this blog post](https://kivooeo.github.io/dynamic-linking-in-rustc/). + # Reduce Parallel Code Generation Units to Increase Optimization [By default][cargo-profile], Cargo specifies 16 parallel codegen units for release builds. @@ -438,4 +448,4 @@ use std::alloc::System; #[global_allocator] static A: System = System; -``` \ No newline at end of file +```