Static Dynamic Library Or Framework

原创 2013年12月05日 12:05:06

First, some general definitions (specific to iOS):

Static library 

- a unit of code linked at compile time, which does not change.

However, iOS static libraries are not allowed to contain images/assets (only code). You can get around this challenge by using a media bundle though.

A better, more formal definition can be found on Wikipedia here.

Dynamic library

 - a unit of code and/or assets linked at runtime that may change.

However, only Apple is allowed to create dynamic libraries for iOS . You're not allowed to create these, as this will get your app rejected. (See this other SO post for confirmation and reasoning on such).

Software Framework

 - a compiled set of code that accomplishes a task... hence, you can actually have a static framework or a dynamic framework, which are typically just the compiled versions of the above.

See the Wiki on Software Framework for more details.

Hence on iOS, your only option is basically to use a static library or static framework (the main difference being that a static framework is distributed as a compiled .a file most often, whereas a static library may simply be included as a subproject - you can see all of the code - which is compiled first and its resulting .a file used a dependency by the project).

Now that we're clear(er) on these terms, setting up a static library and supporting media bundle for iOS isn't too difficult, and there are many tutorials on how to do such. I personally would recommend this one:

This is a pretty straight-forward guide and doesn't have the disadvantage of dealing with "fake static libraries"... check it out for more info...

Once you've created your static library, it's as easy as including it as a submodule within Git for use across different projects.

Regarding a subproject within a project, as far as I know, in order to get this to work/compile correctly, you essentially have to setup a compile chain where the subproject is compiled first, which creates a static framework .a file that is used as a dependency by the project.

Here's another useful tutorial which talks about this:



静态库(Static Library)和动态框架(Dynamic Framework)


【转】Static library & dynamic library -- linux系统下的静态库与动态库

Static library & dynamic library -- linux系统下的静态库与动态库 zz from:

Xcode 4.3中在iOS上应用Static Library及Static Framework笔记

今天看了一天关于Static Library以及Static Frame的相关资料,先记下来,以免忘了。 跟大多数操作系统相同,Mac OS X及iOS上均支持静态链接库和动态链接库(这样说可能有点...

How to Load a Java Native/Dynamic Library (DLL)

(MS Windows) How to Load a Java Native/Dynamic Library (DLL) There are several ways to make it pos...

Moving from Static to Dynamic CGE MODEL

  • 2014年07月27日 12:21
  • 523KB
  • 下载

DLL(Dynamic Link Library),动态链接库。

DLL(Dynamic Link Library),动态链接库。 1.关于__declspec(dllimport)和__declspec(dllexport) 在一个DLL的编写过程中,如果...
  • SJF0115
  • SJF0115
  • 2011年11月29日 16:10
  • 1272
您举报文章:Static Dynamic Library Or Framework