Linux. So is based on a dynamic link under Linux, which functions and acts like a. dll file under Windows.
Typically, the link to the library is done at compile time (compile). All related object files (objects file) are linked to an executable (executable file) that is associated with the library of functions involved. The program is not associated with the library at run time, because all required functions have been copied to their own door, so these libraries are static libraries (static Libaray), usually with the file name "Libxxx.a".
In fact, we can also postpone the link loading of some library functions to the time when the program runs (runtime). This is the dynamic link library technology, the dynamic link library file named "libxxxx.so" form. (so may be an abbreviation for shared object)
Features and advantages of dynamic link library
First let's take a look at the benefits of deferring library functions to the time of program Runtime:
1. Resource sharing between processes can be achieved.
What's the concept? That is, when a program is running to invoke a dynamic link library function, the operating system will first look at all running programs to see if there is a copy of this library function in memory. If so, let it share that copy; only the link is loaded. This mode, while bringing some "dynamic link" additional overhead, greatly saves the system's memory resources. C's standard library is the dynamic link library, which means that all running programs in the system share the same C standard library code snippet.
2. It is easy to upgrade some programs. Users only need to upgrade the dynamic link library, without recompiling the link to other legacy code to complete the entire program upgrade. Windows is a good example.
3. It is even possible to actually sit into the link loader completely controlled by the programmer in the program code.
When programmers write programs, they can clearly indicate when or under what circumstances the link loads into which dynamic link library function. You can have a fairly large piece of software, but each time it runs, only a small number of programs are loaded into memory due to different operational requirements. All functions are based on the principle of "need to be transferred in", thus greatly saving system resources. Today's software, for example, typically opens several different types of files, which are often implemented using dynamic-link libraries. In one run, only one type of file will normally be opened. So until the program knows the type of the file and then loads the corresponding read-write function, instead of loading all the read and write functions from the beginning, it is not known that they are used in the whole program at all.
The. So file under Linux is a dynamic-link library