Static and dynamic libraries in C

A brief intro into its characteristics, main differences and usage.

The static library is part of the program while the dynamic library only creates a symbols table in the program

Creating a static library in Linux

  • the -r flag will update older files within the library
  • the -c flag will istruct ar to create the library if it doesn’t exist
  • staticlibrary is the name of the library to be created
  • file.o is the name of evert object file to be included in the static library
  • -L tells the compiler to search within the current directory for the static library
  • -l gives the name of the library

Creating a dynamic library in Linux

Pros and cons

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store