What’s the difference between static and dynamic libraries?

How do libraries work?

Differences between Static and Dynamic libraries: Advantages and Disadvantages:

How to create and use libraries in Linux:

Static libraries:

gcc -c *.c
$ls *.c 
file1.c file2.c file3.c
$gcc -c *.c
file1.c file 1.o file2.c file2.o file3.c file3.o
ar rc libwhatever.a *o
ranlib libwhatever.a
gcc main.o -l -lwhatever -o program

Dynamic libraries:

gcc -c fPIC *.c
$ ls
file1.c file2.c file3.c headerfile.h
$ gcc -c fPIC *.c
file1.c file1.o file2.c file2.o file3.c file3.o headerfile.h
gcc -shared -o libwhatever.so *.o
gcc -L. main1.c -lwhatever -o printhappyface

--

--

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