开发者

Create a 'dll' in Objective C

开发者 https://www.devze.com 2023-01-07 17:07 出处:网络
I am still going throu开发者_如何转开发gh 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

I am still going throu开发者_如何转开发gh 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?


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


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消