Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does iOS lost most of the advantage of using dynamic frameworks?

Does iOS lost most of the advantage of using dynamic frameworks?

Does it mean if we use dynamic frameworks with dlOpen to load them later, it will be faster than static frameworks? Because the dynamic frameworks take some time to link in the begining, but they save more time in loading into memory. And loading time of static frameworks is greater then the linking time in dynamic frameworks. Is that true?

So it looks like there is none adavantage of using dynamic frameworks on iOS, right?

And how about on macOS and Linux? Do dynamic frameworks have any advantage? If so, how do they work?

like image 645
allenlinli Avatar asked Sep 15 '19 06:09

allenlinli


People also ask

What is dynamic framework iOS?

A dynamic framework is a bundle of code loaded into an executable at runtime, instead of at compile time. Examples in iOS include UIKit and the Foundation frameworks. Frameworks such as these contain a dynamic library and optionally assets, such as images.

Which framework is used in iOS?

The UIKit framework provides the required infrastructure for your iOS or tvOS apps.

What is the difference between static and dynamic library iOS?

Dynamic libraries (*. dylib) are different from static libraries in the sense that they are linked with the app's executable at runtime, but not copied into it. As a result, the executable is smaller and, because the code is loaded only when it is needed, the startup time is typically faster.

What is difference between framework and static library iOS?

Libraries and frameworks are basic building blocks for creating iOS and macOS programs. Libraries are collections of code and data, while frameworks are hierarchial directories with different kinds of files, including other libraries and frameworks. Based on how libraries are linked, they can be static or dynamic.


1 Answers

You're correct in all of this. Non-system (i.e. not provided by Apple) dynamic libraries going to be less efficient in pretty much every way on iOS. They give you no space or memory savings, and they cost you at launch time.

The old Apple document you reference was almost entirely written before the iPhone. It's referring to late-loading libraries in Mac apps, which can help launch time.

On systems with shared libraries (or when using system libraries, which are shared on iOS), dynamic libraries save disk space, and can be shared between processes which saves memory and load time (because it's already loaded by some other process). But if you don't share the library, you can't really get any of those benefits. On systems that allow runtime loading of libraries (not iOS), dynamic libraries can delay the cost of loading seldom-used code, possibly indefinitely (if the code is never used). Furthermore, it opens up the opportunities for plugins and other extensions.

like image 165
Rob Napier Avatar answered Jan 30 '23 01:01

Rob Napier