Differences between the iOS static library and the 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 loaded only once, multiple programs are shared, saving memory.

Second, form

Static Library form: . A and. Framework

Dynamic Library form:. Dylib and. Framework

Among them, the system's. Framework is a dynamic library, which we build ourselves. The framework is a static library.

. 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, and. Framework files can be used directly.

. A +. H + sourcefile =. Framework.

Suggested use the. Framework.

Third, why use a static library?

Easy to share code for reasonable use.

Implement the modularity of 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.

The need to develop a third-party SDK.

Four, limit

Apple officially does not allow users to launch their own dynamic library

The simplest difference, the dynamic library all apps share one copy, static library each app one copy
The reason why Apple does not allow a dynamic library is considered, for example, many apps use Friends League, if friends of the league is a dynamic cry, that in these apps through the Friends of the league Dynamic library to achieve data sharing and even privacy theft will be possible.

Differences between the iOS static library and the 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.