4

I am from a Windows background and I am used to creating SDKs by creating (.dll)s and then distributing all the libraries and Documentation.

So, if a user wants to use it, he adds a reference to the library and uses it. However, in a Mac, I am working on a SDK and I want a way of creating and distributing Mac libraries.

(I want to create the library in Objective-C) Please help me :)

JustSid
  • 25,168
  • 7
  • 79
  • 97
weirdpanda
  • 2,521
  • 1
  • 20
  • 31
  • See: http://stackoverflow.com/questions/7250302/how-do-third-party-libraries-work-in-objective-c-and-xcode/7251559#7251559 – bryanmac Dec 14 '13 at 19:02

2 Answers2

6

If you're creating a Mac library, you have either the option of creating a dylib, which includes only the compiled binary for the library, or creating a framework, which includes the compiled binary as well as headers and other bundle resources used by the library, in a single package. Frameworks are the preferred method of library distribution for the Mac.

If you're creating an iOS library, iOS doesn't support dynamic libraries of any kind (no dylibs or frameworks) so you're stuck with creating static libraries to distribute your code.

indragie
  • 18,002
  • 16
  • 95
  • 164
  • I am creating a Mac library (you got me). I have tried creating a "framework" but am not able to. (Even with the settings described in various articles.) Can you please guide me? – weirdpanda Dec 14 '13 at 21:42
  • Which step are you having trouble with? The linked Apple documentation in my post is quite extensive. – indragie Dec 15 '13 at 01:36
  • I tried creating a framework, with settings described in various articles. The build succeeded, and I included in my app, now when I run it: it throws an exception saying "image not found". Tried using "otool", no use. Can you please guide me on how to create and use a framework from scratch? – weirdpanda Dec 15 '13 at 17:04
  • That means the Installation Directory of the framework and/or the Runpath Search Paths of the app bundle weren't set correctly. Check the tutorial here on how to set those up: http://www.dribin.org/dave/blog/archives/2009/11/15/rpath/. The screenshots are from an older version of Xcode but you can find the same settings under the Build Settings for each target in newer versions of Xcode. – indragie Dec 15 '13 at 21:12
  • Can you please send me an example project? Nothing in it, just the configurations. Or can you tell me the configurations required? – weirdpanda Dec 16 '13 at 10:08
  • The configurations are in the blog post I linked to in my previous comment. – indragie Dec 16 '13 at 22:21
0

Both Mac and iOS have Dynamicly Linked Libraries. They just are not called that. They are generally just referred to as Shared Libraries and they typically are wrapped in Frameworks.

Unfortunately, iOS limits the use of Shared Libraries to System Libraries and does not allow installing shared libraries on non-jailbroken devices.

Both platforms also support Static Libraries.

Holly
  • 5,270
  • 1
  • 24
  • 27