Static and dynamic libraries

  • How do they work:
  • How to create them:
gcc -c lib_mylib.c -o lib_mylib.o
ar rcs lib_mylib.a lib_mylib.o
  • How to use them
gcc -c driver.c -o driver.o
gcc -o driver driver.o -L. -l_mylib
./driver 
fun() called from a static library
  • What are the differences between static and dynamic libraries

--

--

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