Static Dynamic Library Or Framework
2013-12-05 12:05
495 查看
First, some general definitions (specific to iOS):
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.
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).
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
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
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:
https://github.com/jverkoey/iOS-Framework
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
that is used as a dependency by the project.
Here's another useful tutorial which talks about this:
http://www.cocoanetics.com/2011/12/sub-projects-in-xcode/
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 dynamicframework, 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
.afile
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
.afile
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:
https://github.com/jverkoey/iOS-Framework
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
.afile
that is used as a dependency by the project.
Here's another useful tutorial which talks about this:
http://www.cocoanetics.com/2011/12/sub-projects-in-xcode/
相关文章推荐
- Linux learning jottings(2)-static or dynamic library
- linux static and dynamic library
- Static or dynamic lib in vs
- 关于静态库(Static library or Archive library)
- 使用CxImage (Using MFC by a Static Library + Realese or Debug 模式)
- Dynamic linking static library on iOS
- 关于Reveal Are you trying to load dynamic library with Reveal Framework already linked?
- how to compile and link static/dynamic library in linux
- Static library & dynamic library -- linux系统下的静态库与动态库
- Microsoft Visual Studio ~ C/C++ Runtime Library ~ Static/dynamic linking
- Cross Compile zlib as static and dynamic library
- Modifying a Dynamic Library Without Changing the Source Code
- This Handler class should be static or leaks might occur Android
- static_cast, dynamic_cast, const_cast探讨
- 四种强制类型转换的总结(const_cast、static_cast、dynamic_cast、reinterpreter_cast)
- c++强制类型转换(static_cast 和dynamic_cast)
- You must use the Role Management Tool to install or configure Microsoft .NET Framework 3.5 SP1
- JavaServer Faces 2.0 requires Dynamic Web Module 2.5 or newer..Maven Java EE Configuration
- dynamic linke library example (C/C++)
- static_cast,const_cast,dynamic_cast,reinterpret_cast