Sharing Compiled Code: Building Static Libraries in XCode for the iPhone

By
On December 3, 2008

static-linking.png Due to the potential for abuse, dynamic libraries aren’t allowed to be used in iPhone applications that are to be sold on the iPhone App Store. The downside to this is that it makes it harder to share libraries that you develop with other developers without giving up the code.

It’s not impossible to share a binary of some of your code, however! iPhone Developer Brian Stormont has written a tutorial on building static libraries with the iPhone SDK. He had developed a streaming audio library that he was willing to share (without source) with a client and compiled it into a static library so that they could link it directly into their own app.

0 responses to “Sharing Compiled Code: Building Static Libraries in XCode for the iPhone”

  1. Jehiah says:

    There are also some great sqlite libraries for the iPhone out there, but they all seem to be distributed as source not as static libraries (the best of which IMHO is fmdb by gus mueller). It’s good to know though that libraries could be distributed either way.

  2. Clint says:

    If the library is being distributed as an Xcode project (i.e., with source code) using a cross-project reference to build the static libraries “on demand” can be handy. I’ve got a tutorial on this at https://www.clintharris.net/2009/iphone-app-shared-libraries/ in case it’s helpful for anyone else.