Iphone – Can an XCode static library require linkage with a dynamic library

iphonexcode

I have created a static library in XCode that requires several dynamic libraries (e.g. libsqlite3.0.dylib). I can create an application that is dependent upon my static library using cross-project references in XCode, but it seems that I have to manually add all of the required dynamic libraries to each of my application projects to get them to link.

Is there any way to configure a static library project in XCode so that dependent applications will automatically link against whatever dynamic libraries it requires?

I tried adding the dynamic libraries to the list of Frameworks in my static library project, but this seemed to have no effect.

Best Answer

Yes -- you will need to add the libraries to the applications. A static library -- a .a -- is just an archive of .o files with a minimal bit of internal symbol resolution. The full symbol resolution doesn't happen until you link it into an application (or framework).

(Are you using sqlite3 directly? If so, why not use Core Data? There are reasons, but not nearly as often as people thing...)