The . So file in Linux is the product of dynamic linkingShared libraries are understood to provide a collection of functional functions that provide standard interfaces externally
rules for shared libraries in naming systems in Linux
Major Version Number: incompatible minor version number between different version numbers: Incremental upgrade backward-compatible release version number: Bug fixes and performance improvements for minor versions, no impact on compatibility Linux shared libraries are not all such formats such as GLIBC's shared library named: LIBC-X.Y.Z.SO Dynamic linker Also is part of GLIBC, using ld-x.y.z.so named LIBM (Math library), etc.
so-name mechanismThe format of the shared library to be linked in the system and program is generally: libname.so.x is generally a carton system in the main version number of the same name, the minor version number of the highest share of the shared library, The purpose is to ensure that the latest version is used on a compatible basis in the relevant fields of the executable file (the elf file in Linux) is so-name when the shared library is upgraded, there are two cases: 1) The main version number is unchanged, the shared library is only incremental upgrade (to ensure that all the original does not change, Add a new interface on this basis, does not affect the correctness of the original program run at this time, the original version does not need to exist, all with the new Shared file library file replacement of the existing old version (minor version of the lower) file, and then run ldconfig[) will be 2) major version number changes, At this point in the upgrade you need to keep the original old version of the shared library (in order to be compatible with this version of the original shared library executable program), but also need to save the new version of the shared library
Ldconfig in LinuxWhen installing or updating a shared library in the system need to update the soft link and dynamic linker to find files so should be run in time ldconfigldconfig function is to traverse all of the shared library directory/lib/usr/lib, etc. Updating soft links based on the version of the actual shared library The use of shared libraries when GCC is compiled is simpler, and does not require spelling so-name etc. gcc-o Hello Hello.c-lname can be linked to libname.so.x.y.z (version in the system using the form above) The dynamic linker mounts or looks up the shared object in the following order (1) by the environment variable Ld_library_path specified path 2) by path cache file/etc/ld.so.cache specified path 3) The default shared directory is/usr/lib/lib
Ld_library_pathis an environment variable that, when you specify a program's Ld_library_path, the dynamic linker finds the shared library first, starting from the specified path.
Naming and dynamic linking of Linux shared libraries. so files