• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Need advice about how to create a Cocoa Framework
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Need advice about how to create a Cocoa Framework


  • Subject: Re: Need advice about how to create a Cocoa Framework
  • From: Harry Jordan <email@hidden>
  • Date: Wed, 19 Aug 2009 10:57:33 +0100

Do you mean that you want to write an Objective-C wrapper to the C library, or just group the C functions into an easily accessible place?

If your wrapping things in Objective-C, try not to change any of the C library (of course tidying, and bug fixing as you go's allowed). Write the framework files in separate .h and .m files as an abstract layer on top. In this case the convention is to have one central header file that references all the other headers, to make it easy the framework to #include in projects.

If you've just grouping your normal C files into a framework, it might be better to #include only the specific header files that you need, because it minimizes unexpected name-space conflicts (this might only be a problem if you libraries are big and generic). You add the .a files as normal, but might want to add a Copy Files build phase to your project so that they are placed into a "Static Libraries" folder, or similar. When you reference these libraries in the Build settings it's important to use @loader_path/../ rather than @executable_path/../ or a static file path reference.

Frameworks are very flexible. For the most part you can treat them like a normal application. Make sure you mark the header files that you want to be made as public, and accessible to the outside world. All in all, frameworks aren't that scary.

Harry
http://inquisitivesoftware.com/


On 19 Awst 2009, at 01:05, Gevik wrote:

Hi All,

I have an old C library which I need to reuse in my Cocoa applications. The C library has some header files. (contact.h and exchange.h etc ...)
There are also two lib files (exchanger.a and archiver.a).


I would like to know what (and how) the recommended way is to bundle my C library as a Cocoa framework so I don't have change the lib and the include settings in Xcode everytime I want to use this library.

Any advice is appreciated.

Thanx.
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Need advice about how to create a Cocoa Framework
      • From: Jerry Krinock <email@hidden>
References: 
 >Need advice about how to create a Cocoa Framework (From: Gevik <email@hidden>)

  • Prev by Date: Re: Get size of folder
  • Next by Date: Re: [iPhone 3.0; XCode 3.1.3] Question about when views are available for manipulation.
  • Previous by thread: Need advice about how to create a Cocoa Framework
  • Next by thread: Re: Need advice about how to create a Cocoa Framework
  • Index(es):
    • Date
    • Thread