 |
 |
frameworks, bundles, and dylibs. 3 questions.
|
 |
|
 |
|
Registered User
Join Date: Oct 2003
Status:
Offline
|
|
I'm trying to understand why there are so many library file formats on OS X and what they mean. It seems a bit redundant -- maybe someone here would be so kind as to educate me. (Note, I'm coming from a GNU/Linux background.)
1. What is the purpose of frameworks? (I.e. those directories in /System/Library/Frameworks, /Library/Frameworks, and ~/Library/Frameworks.) Why not just link the requisite *.dylib's into the executable? Is it simply to save me from typing -I/... -L/... -l/... into my makefile?
2. What's the difference between *.dylib files and *.bundle's? Actually, I should be asking, what's the difference between .dylib's and the no-extension files residing in *.bundle directories? Aren't they both just shared libs?
3. In frameworks -- usually in the Foo.framework/Versions/A directory -- there's an important looking file with no extension that the 'file' command tells me is a dylib. Why doesn't it have a .dylib filename extension? Why does it seem the filename extension convention is ignored here?
Thanks!
(Last edited by johnMG; Jun 20, 2004 at 08:23 PM.
)
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Sep 2000
Location: Tempe, AZ
Status:
Offline
|
|
A framework wraps multiple versions of a dylib along with associated resource files and other support stuff like headers into one unified (you guessed it!) framework. A framework is one type of a bundle. An application is another type of a bundle.
|
Geekspiff - generating spiffdiddlee software since before you began paying attention.
|
| |
|
|
|
 |
|
 |
|
Addicted to MacNN
Join Date: Mar 2000
Location: London, UK
Status:
Offline
|
|
Originally posted by johnMG:
1. What is the purpose of frameworks? (I.e. those directories in /System/Library/Frameworks, /Library/Frameworks, and ~/Library/Frameworks.) Why not just link the requisite *.dylib's into the executable? Is it simply to save me from typing -I/... -L/... -l/... into my makefile?
As smeger said, frameworks are just a way of encapsulating a library with its associated headers and other resources for organisational reasons (rather than, say, having headers in /usr/include libs in /usr/lib and other stuff in /usr/share - which is rather messy). See http://developer.apple.com/documenta...rks/index.html.
[B]2. What's the difference between *.dylib files and *.bundle's? Actually, I should be asking, what's the difference between .dylib's and the no-extension files residing in *.bundle directories? Aren't they both just shared libs?
No. Mach makes a distinction between shared libraries (MH_DYLIB) and dynamically loadable bundles (MH_BUNDLE). For example, MH_BUNDLEs can be told to resolve symbols against an executable (-bundle_loader link flag), and can be unloaded (providing they don't contain Objective-C code) whereas dylibs can't. See ld(1) and http://developer.apple.com/documenta...section_4.html and stuff.
Note that the term "bundle" is also used in a more general sense to refer to packages of files that group stuff together - applications, frameworks, etc. See http://developer.apple.com/documenta...les/index.html
3. In frameworks -- usually in the Foo.framework/Versions/A directory -- there's an important looking file with no extension that the 'file' command tells me is a dylib. Why doesn't it have a .dylib filename extension? Why does it seem the filename extension convention is ignored here?
No idea, probably just an arbitrary decision. Why does it matter?
|
|
|
| |
|
|
|
 |
|
 |
|
Registered User
Join Date: Oct 2003
Status:
Offline
|
|
Thanks for the replies smeger and Angus. And also Angus, thanks for the links. I'm reading them now.
Mach makes a distinction between shared libraries (MH_DYLIB) and dynamically loadable bundles (MH_BUNDLE). For example, MH_BUNDLEs can be told to resolve symbols against an executable (-bundle_loader link flag), and can be unloaded (providing they don't contain Objective-C code) whereas dylibs can't.
Ah.
> Why does it seem the filename extension convention is ignored here?
No idea, probably just an arbitrary decision. Why does it matter?
I thought maybe there was some important reason why, but I just wasn't getting it.
Thanks again.
|
|
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|