Re: Questions About Frameworks
Re: Questions About Frameworks
- Subject: Re: Questions About Frameworks
- From: "Mark A. Stratman" <email@hidden>
- Date: Sat, 10 Jul 2004 23:03:58 -0500
On Jul 9, 2004, at 11:36 PM, Gus wrote:
Next, I'm wondering what the differences are between a .framework and
a .dylib..? I've seen both in a lot of places, and it's puzzling to
me. I'm also wondering why dylibs don't have headers, and since they
don't, how would you call their methods or use their classes (there
aren't only C dylibs...)?
In short: a dylib is a single library file, a bundle is a directory
containing a collection of files (which may include dylibs).
In a bit more detail:
A .dylib file is a Mach-O shared library (MH_DYLIB file). It is a
single binary file. If you've programmed on Unix or GNU/Linux before,
you can think of it like .so shared object file.
For example, if you were going to port libwhatever.so.1.2 from Linux to
OS X, it would be compiled as libwhatever.1.2.dylib.
Regarding why they do not have headers.... well, they usually do. If
you have a program pre-compiled for your architecture and its linked to
a library, it should work just fine.
But in order to compile code that uses a dynamic library, you must
include its headers.
Any publicly available functions/methods in a dylib should be declared
in a header. This header or headers would be in separate files. So if
you wanted to install your libwhatever, you would put
libwhatever.1.2.dylib in a lib directory such as /usr/lib, and
whatever.h somewhere like /usr/include.
A framework is a special "bundle"
(
http://developer.apple.com/documentation/CoreFoundation/Conceptual/
CFBundles/index.html). A bundle is essentially a directory containing
a specific hierarchy of files and sub directories (which can be
deceiving, since it looks and acts like a single file in Finder).
More about frameworks here:
http://developer.apple.com/documentation/MacOSX/Conceptual/
BPFrameworks/Concepts/FrameworkAnatomy.html
Because frameworks are actually a directory of other files/directories,
you can store the headers, resources such as images or nibs, dylib
library/libraries, and anything else you want.
A typical framework will have dynamic libraries and their headers in it.
So a benefit of frameworks over a regular library is that it keeps all
this stuff together, rather than the typical Unix-way of scattering
these various files throughout the file system (in lib, include, share,
etc).
hth
- mark
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.