Back to our hello World analysis, this program is useful because of output. That is to say, output Hello World to the screen.
So how does he achieve this? The simplest method is to use the application programming interface provided by the OS. That is, the API.
In general, a language development environment usually comes with a language library. These libraries are the encapsulation of operating system APIs.
For example, in Hello world, the printf of the standard library is used to output the text information "Hello world". In fact, the prinf function is actually running on the string.
After some necessary processing, the operation system API will be called at last. In Linux. Is the system call of the called write.
Of course, there are many functions in the C language library that do not need to call system APIs, such as strlen () functions.
Therefore, the static library can be viewed as a set of target files. Is a file formed after many target files are compressed and packaged.
For example, run the usr/lib directory under Ubuntu and enter the command
Ls-L *.
In fact, this. A is an important static library in Ubuntu. We analyzed it using Ar-T and found that it actually contains several. O files.
Of course, in Ubuntu, dynamic loading is often used. For example, our hello World Program
These so libraries are dynamic link libraries.
Static Library Link