4

Can someone explain to me the fundamental differences between a Cocoa framework and a C static library?

In particular, I'm finding out that in both cases I have to reference the file (.framework or .a) in the "Link Binary with Libraries" part for my target in Xcode.

However, I don't seem to have to put the .a in "Copy Files". I only have to put .framework into "Copy Files". What is the reason for this difference?

Enchilada
  • 3,859
  • 1
  • 36
  • 69

1 Answers1

9

A static library is actually compiled as part of your app, whereas a framework is distributed with your app (or system frameworks are already present) and linked dynamically. Also see this question.

Community
  • 1
  • 1
jtbandes
  • 115,675
  • 35
  • 233
  • 266
  • Thanks. But what about .dylib? Those would have to be put into the "Copy Files" build phase, right? However, should they be copied into the "Frameworks" folder? How does the app know where to look for the .dylib and .framework files, when it comes across a function call it otherwise cannot find? – Enchilada Jul 21 '11 at 15:37
  • A dylib is also dynamically linked. Function calls are resolved at compile time (when the linker runs). – jtbandes Jul 22 '11 at 02:21