【mac之 dylib类型】
1、dependent library
A dependent library, from the client’s point of view, is a dynamic library the client is linked with. Dependent libraries are loaded into the same process the client is being loaded into as part of its load process. For example, when an app is launched, its dependent libraries are loaded as part of the launch process, before the main function is executed. When a dynamic library is loaded into a running process, its dependent libraries are loaded into the process before control is passed to the routine that opened the library.
2、 runtime loaded library
A runtime loaded library is a dynamic library the client opens with the dlopen function. Clients do not include runtime loaded libraries in their link line. The dynamic loader, therefore, doesn’t open these libraries when the client is loaded. Clients open a runtime loaded library when they’re about to use a symbol it exports. Clients don’t have any undefined external references to symbols in runtime loaded libraries. Clients get the address of all the symbols they need from runtime loaded libraries by calling the dlsym function with the symbol name.
中文总结:
1、dependent library是在程序启动时要完全加载的,这类dylib在编译时通过头文件引用了相应dylib中的符号,所以必须在程序启动时加载相应的dylib。
2、runtime-loaded library是通过DLC函数来加载的dylib,源程序中绝不包含这类dylib中的符号的引用,要引用这类dylib中的符号,必须通过dlsym函数来寻找。