Re: Need advice about how to create a Cocoa Framework
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