Static Libraries in C.

When thinking on how to get the most of some of those portable cleaver solutions you find to problems when coding, creating your own library (or libraries) is something you should seriously consider.

Gathering the tools

  1. Gather the functions you want to add to a library.
  2. Compile all the .c files into object files ($ gcc -c *.c or gcc -c file_name.c)
  3. Create the static library (ar -rc liblibrary_name.a *.o)
  4. Index the library (ranlib liblibrary_name.a)

But how do I use it?



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