What is the difference between a static library and a dynamic library?

Source: Internet
Author: User

 First, what is a library?   Library is the way to share program code, generally divided into static library and dynamic library.   Static Library: When the link is completely copied to the executable file, multiple copies of the redundant copy are used.   Dynamic Library: Link is not copied, the program is dynamically loaded into memory by the system, for program calls, the system is only loaded once, multiple programs shared, save memory.   The form of static library in iOS?  .a and .framework  Four, iOS in the form of dynamic library?  .dylib and .framework , why is the framework both a static library and a dynamic library?   System. The framework is a dynamic library, which we build ourselves. The framework is a static library. What is the difference between a   VI and a. Framework?  .A is a pure binary file, and the. Framework has a resource file in addition to the binaries.  .A files cannot be used directly, at least with. h files,. Framework files can be used directly.  .A +. H + sourcefile =. Framework.   Recommended .framework.  Seven, why use a static library?   Easy to share code for reasonable use.   modularity for iOS programs. A fixed business module can be made into a static library.   Share your code base with others, but don't want others to see your code implemented.   Developing the needs of third-party SDKs.   Eight, the production of static libraries when the note:  1 attention to understanding: whether it is. A static library also. The Framework static library, what we need is a binary file +.h+ other resource files, different,. A itself is a binary file, We need our own. h and other files to use, and. The framework itself already contains. h and other files that can be used directly.  2 Image Resources processing: two static libraries, usually the picture file is placed in a separate. bundle file, general. The name of the bundle is the same as the name of the. A or. Framework. bundle files are good, create a new folder, Rename it to. Bundle on it, right-click to display the contents of the package to which you can add a picture resource.  3 category is often used in our actual development projects, it is no problem to make the category into a static library, but in the project using this static library, there will be no run-time error to find the method when calling the method in the category (selector not RecogniZed), the workaround is to configure the other linker flags value to-OBJC in the project that uses the static library.  4 If a static library is complex, If you need to expose the. h more, you can create an. h file inside the static library (typically the name of the. h file is the same as the name of the static library), and then put all of the. h files that need to be exposed in this. h file, and those that need to be exposed. h do not need to be exposed, just have to expose the. h.

What is the difference between a static library and a dynamic library?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.