Skip to content
Commitwise
Menu

Static vs dynamic linking

Also called: Static library, Dynamic framework

Static linking copies a library's code into each binary that uses it; dynamic linking loads one shared copy at runtime.

Definition

Static libraries make launch faster (no extra library to load) and let the linker drop unused code, but every binary that links one gets its own copy of its code and global state. Dynamic frameworks are shared between an app and its extensions but add launch time for each one loaded. Swift package libraries are linked statically by default.

In practice

An analytics module linked statically into both the app and a dynamic framework ends up with two separate singletons.

Learn it in context

Lessons that use this term.

Related terms

Esc

Type to search the whole site.