Differences between static and dynamic libraries

Ethan Roberts
1 min readDec 15, 2020

There are two different types of libraries I am going to be talking about. One is the dynamic library and the other is the static library. They are similar and different in their own ways. I personally find them useful and cant wait to get more experience using them.

What is a library?

A library is a collection of items that are callable by programs. This can be useful when having multiple files being called and stored in the same place.

What is the main difference?

While static libraries are made and used perfectly find they are locked to being changed once created but dynamic libraries can be edited and updated at will without having to recreate the library.

Static Libraries are simple to make with just one command.

ar rcs libmylib.a objfile1.o objfile2.o objfile3.o

When you run this command it will create the static library libmylib.a

Dynamic Libraries are also simply made with a single command

gcc *.o -shared -o liball.s

Once ran this will create your dynamic library named liball.s