Definitions – Dynamic vs static library

Loading-Library-Files-Opener-Image-590x267

Dynamic vs Static library

A static library gets compiled into the client. A .lib is used at compile time and the contents of the library become part of the consuming executable.
A dynamic library is loaded at runtime and not compiled into the client executable.

 

Static library – Pro / Cons

static library

Lib pros: no performance impact as code is always loaded in the process and is not rebased; no versioning problems.
Lib cons: executable/process “bloat” – all the code is in your executable and is loaded upon process start; no reuse/sharing – each product has its own copy of the code

Dynamic library – Pro / Cons

Dll pros: can be used to reuse/share code between several products; load in the process memory on demand and can be unloaded when not needed; can be upgraded independently of the rest of the program.
Dll cons: performance impact of the dll loading and code rebasing; versioning problems (“dll hell”)

dynamic library

Leave a comment

Your email address will not be published.