C static libraries. A story short.

The paradise will be a librarie

Why use libraries?

As we are doing computer programs, we realize that some parts of the code are used in many of them. For example, we can have several programs that use complex numbers and the functions of addition, subtraction, etc. are common. It is also possible, for example, that we like to make games, and we realize that we are repeating the code again and again to move an image (a Martian or Lara Croft) on the screen.

How we have to organize our code. How they work?

To be able to put our code in a library, we need to organize it in the following way.

How to create them

Look us an graphic example

How to create own C statics libraries

Now, how can we use the library?

As in a pile of disorganized books in the library, we will sort the libraries and index them with the command ranlib, Afterwards, we can view our newly-indexed library using the command nm

Bibliography