IOS-static library creation and use, ios-static library
In daily project development, whether it is for business communication between two company projects or to reduce the Compilation Time of the project, sometimes we pack the private content of the project into a static library, or package a small part of the changes in the project into a static library to Improve compilation efficiency. Let's take a look at "create and use iOS-static library ":
(1) differences between iOS static library, dynamic library, and Framework static library and dynamic library:
(1) What is a database?
Library is simply a piece of compiled binary code, and header files can be used by others (for example, compiled by Objective-C in iOS. h and. m file, which is changed. h and. file );
(2) What is a static database?
① The static library is the static link library (for example,. lib in windows,. a in Mac, And. a in Linux );
② The static library will be directly copied to the target program during compilation, and the code will not be changed in the target program, I guess this is also the reason why the database is called "Static Database;
③ Advantages and Disadvantages of static databases:
1) Benefits: After the static library is compiled, the library file actually does not work, and the target program can run directly without external dependencies;
2) Disadvantages: static databases increase the volume of the target program;
(3) What is a dynamic library?
① A dynamic library is a dynamic link library (for example,. dll in windows,. dylib in Mac, And. so in Linux );
② Contrary to the static library, the dynamic library will not be copied to the target program during compilation, and the target program will only store references pointing to the dynamic library. When the program runs, the dynamic library will be actually loaded in;
③ Advantages and Disadvantages of dynamic libraries:
1) profit: the volume of the target program does not need to be copied to the target program, and the same database can be used by multiple programs (for this reason, dynamic libraries are also called shared libraries). At the same time, the features loaded during compilation can also be replaced at any time without re-compiling the Code;
2) Disadvantages: dynamic loading may cause some performance losses. Using a dynamic library may also make the program dependent on the external environment. If the environment lacks a dynamic library or the library version is incorrect, the program cannot run;
(4) When will we use the database?
① Some code snippets need to be used by others, but we do not want others to see the source code, we need to encapsulate them in the form of a library and only expose the files in the early stage;
② For some code that will not be significantly modified, We can package it into a library to reduce the compilation time, because the library is compiled binary, you only need to Link it during compilation, so it will not waste compilation time;
Note: Link is required when the library is used. There are two Link Methods: static and dynamic, as a result, the static library and dynamic library (the thought of "attacking the city Lion" is so simple