Linux Basics: Static Libraries vs. Dynamic Libraries
If you’re wondering how static and dynamic libraries work in C programs, here is the place where I will answer you this tricky question, let´s start! What´s a Library in Linux? A library is a collection of pre-compiled pieces of code called functions . The library contains common functions and together, they form a package called a library . Functions are blocks of code that get reused throughout the program. Using the pieces of code again in a program saves time. A library is not executable and that is a key difference from processes and applications. Libraries play their role at run time or compile time. In the C programming language, we have two types of libraries: dynamic libraries and static libraries. Static libraries , while reusable in multiple programs, are locked into a program at compile time. Dynamic, or shared libraries on the other hand, exist as separate files outside of the executable file. How works a static libra...