3

I was learning the knowledge about Library and Framework in iOS recently. However I was confused about the concept of Dynamic Library and Dynamic Framework, and I didn't found the creation of Dynamic Library.

huangxinyu
  • 247
  • 3
  • 11

3 Answers3

1

TL;DR

  • Dynamic library - a shared library of code dynamically loaded into a process at runtime
  • Framework - a shared library packaged with associated resources, can contain other dynamic libraries

There is also a term "Umbrella framework" - it's a framework that serves as the “parent” of a group of frameworks and shared (dynamic) libraries


Apple's documentation Loading Code at Runtime states the following:


Dynamic library

Programmers often refer to dynamic shared libraries using different names, such as dynamically linked shared libraries, dynamic libraries, DLLs, dylibs, or just shared libraries. In OS X, all these names refer to the same thing: a library of code dynamically loaded into a process at runtime.

Framework

A framework is a shared library packaged with associated resources, such as headers, localized strings, and documentation, installed in a standard folder hierarchy, usually in a standard location in the file system. The folders usually contain related header files, documentation in any format, and resource files. A framework may contain multiple versions of itself, and each version may have its own set of resources, documentation, and header files.

0

Dynamic Libraries have the extension .dylib (DynamicLib). Frameworks contain Static Libraries within them, but also contain the headers to go along with those libraries. I've even seen a Framework contain bundles (resources) within them. I am not sure if Frameworks can contain dynamic libraries*.

So think of frameworks like a packaging system that is simpler to load.

For Dynamic libraries, you need dlopen to load them, and dlsym to get function pointers within them. Use the function pointers then dlclose to close the handle to the library.

Brandon
  • 22,723
  • 11
  • 93
  • 186
0

iOS Dynamic library vs Dynamic framework

Framework contains a library plus some other resources. Dynamic framework contains dynamic library. Dynamic library.dylib is a set of files which are linked in ryntime. It is not possible create a bare static library(as not a part of framework) because it is not supported yet for developers, but such type are used by OS to share binary, e.g. Swift Standard Library[About]

[Read more here]

yoAlex5
  • 29,217
  • 8
  • 193
  • 205