views:

66

answers:

3

I am still going through a beginners textbook but nowhere does it explain how to create and reference a 'dll'. I assume its called something different but if I wanted to for example create a dll to store all my LocaleHelper code, how would I go about creating it and then referencing it.

I see in xcode you can't add more than one project?

+1  A: 

You can't dynamically load code at runtime with iphone-sdk, at least not if you want your app in the App Store. But to answer your question, you can create a dynamic library (.dylib) or a bundle and then use NSBundle class to load the code at runtime.

See this Apple doc

Benj
A: 

If you are writing mac code, you can create a framework project. If you are using the iOS SDK, you can create a static library and add it to your projects with the correct header files. Note that for the static library, you are going to want to have it be a "fat" binary. Meaning it should be built using the various architectures (i386, armv6, armv7) and lipo'd together.

Elfred
I have created a static library and built it. But it create several different files. Does it not package it into one file that I can reference in another project?
TheLearner
Can you explain what you mean with "created several files". You should have some .a files per platform that you have built them for. If that is the case, you can use lipo to create a universal binary for the .a files. do a "man lipo" in the terminal to see how that is done.
Elfred
A: 

Developing for MAc (and iPhone) is very different to developing for Windows. Any code that is only required for that application should be included within the application.

If you are aafter re-useable code you should look into creating a framework, and include that in your project.

If you do not need to create a framework, you could use folder within XCode to sort your classes into appropriate groups.

Having lots of DLL files (in Windows development) is often seen as an issue for deployement of applications (try searching for DLL Hell in google). Programming in Objective-C/XCode will allow you to compare the different programming patterns and practices and make up your own mind over which way works best.

esde84
I don't see how that differs from Windows development at all. You may include any code you want within your application folder on Windows as well. DLL hell is effectively gone since Vista.
Axel Gneiting