#import
vs. #include
and static vs. dynamic linking are two completely unrelated topics.
#include
includes the contents of a file directly in another file, and is available in C (and therefore also in Objective-C). However, it's common to want to include the contents of a file only if that file hasn't already been included. (You don't, for example, want to declare the same variables twice; it'd cause compiler errors!) That's why #import
was added in Objective-C; it does exactly that: includes the contents of a file only if that file hasn't already been #import
ed. If you're not sure what to use, you should probably be using #import
.
Static vs. dynamic linking is completely different--linking happens after compilation, so it couldn't possibly be related to #import
and #include
, which are part of the source code. Your thoughts on linking are exactly correct, however--statically linked libraries are included in your app, and your users don't need them. Dynamically linked libraries are referenced, and must be present on your users' machines for your app to run.