I am looking for an in-depth explanation of how linking to a framework works. What happens during the link phase during a build vs. what happens at runtime? How specifically is optional linking a framwork different than required linking? Does anyone know a reference to an article that explains this?
-
Xcode uses the [Mach-O Linker](http://en.m.wikipedia.org/wiki/Mach-O) – CodaFi May 12 '12 at 17:39
-
I'm also interested on linking of 'Required' and 'Optional' libraries works. We are using a external library who tells us we need to add the AdSupport one as 'Optional'. They say that the App will crash on iOS 5.x if we add it as 'Required', but I'm trying it on a iOS 5.x device with it being added as 'Required' and it works. – Ricardo Sanchez-Saez Apr 26 '13 at 11:23
-
1There is an excellent explanation here: http://stackoverflow.com/questions/16922013/what-does-it-mean-to-weak-link-a-framework/28597877#28597877 – HenryRootTwo Feb 19 '15 at 02:50
1 Answers
WELL there's nothing as weak and strong linking in terms of library or framework linking.
Strong and weak references are for variables .See Apple Documentation
Moreover linking for the inbuilt libraries and the custom libraries are different.Also Static libraries can only be built and linked in iPhone and no dynamic libraries.
If you are talking about binding of library at compiler level then apple will definitely guide you through this (linking and binding at compiler level is same for almost all the compilers and is out of scope of this discussion) .To link static libraries you have change header search paths , add it to the target , add the dependencies ,etc here's an example to create and link static library
When you compile the code for the first time , the compiler makes references to the compiled classes in static library and headers and it does not get compiled every time unless it has changes.

- 6,068
- 1
- 23
- 25
-
Sorry, I am using "weak" and "strong" in a different context here. I believe XCode now refers to this as "optional" and "required". Apple's documentation talks about "weak" linking in the context of building a Mac application but I think their documentation is not updated (https://developer.apple.com/library/mac/#documentation/MacOSX/Conceptual/BPFrameworks/Concepts/WeakLinking.html). I clarified my question by using the terms "required" and "optional". – pbx May 12 '12 at 18:36