The difference between a static link library and a dynamic link library
One, Static link library
compilation, compilation, compiling, precompiled--links
Linux:
To generate a target file
g++-C Source.cpp-o SOURCE.O
Package as a static link library
AR-CRV Source.a SOURCE.O
Using the static link library
g++ test.cpp-l Static link library directory-l static link library name no suffix
Second, dynamic link library
The use of dynamic link libraries is a two-point problem to circumvent static link libraries.
One is the problem of multiple replicas, for the static library is compiled at the time of compilation into the source code, at run time no longer have any relationship with the static library. The advantage is fast, but it creates a waste of space.
The other is the issue of consistency and update issues, if it is a static library, if the static library is updated, then need to recompile the code, and prompt users to download the entire software, which will cause a lot of constant, wasting a lot of bandwidth. In the case of a dynamic library, only the corresponding dynamic link libraries need to be updated, and the entire software does not need to be modified.
Linux platforms:
To generate a target file
g++-fpic Source.cpp-o SOURCE.O
Dynamic Link Library
g++-shared source.so SOURCE.O
or merge into one command
g++-fpic-shared source.so Source.cpp
There are some issues to be aware of when locating a dynamic link library in use, the default dynamic-link library is under/lib or/usr/lib
If you want to modify the/etc/ld.so.cache file under a different folder
[1] http://www.cnblogs.com/skynet/p/3372855.html
[C + +] The difference between a static link library and a dynamic link library