Re: Frameworks Inside Applications
Re: Frameworks Inside Applications
- Subject: Re: Frameworks Inside Applications
- From: Kurt Revis <email@hidden>
- Date: Tue, 4 Dec 2001 13:01:21 -0800
In an application that I am building, I have a framework that is
linked to by several plugins and the application itself. Everything
works fine when I launch from PB, or I copy the framework to one of the
predefined locations (i.e. /Library/Frameworks/ et.al.), but I want to
be able to store it inside the application bundle itself (like OmniWeb
and others).
After reading over the relevant sections of
<file:///Developer/Documentation/Essentials/SystemOverview/> several
times,
and looking at the internal structure of OmniWeb.app, I concluded that
I could copy the framework (during my PB build) to
<app>/Contents/Frameworks or to <app>/Contents/SharedFrameworks, and
all would be well. Of course, nothing ever works the first time :)
When I launch my app (outside of PB), it obviously can't find the
framework, as it doesn't even get a full bounce in before it dies. I
assume that I have to pass some special flags to ld, but I can't figure
out which. Any help would be appreciated.
As usual, the System Overview doesn't tell you the whole truth.
Some instructions on how to do this are in the ProjectBuilder help (of
all places):
http://developer.apple.com/techpubs/macosx/DeveloperTools/ProjectBuilder/ProjectBuilder.
help/Contents/Resources/English.lproj/TargetOptions/Copying_Fil_le_Building.
html
The "@executable_path" stuff is the important part. Note that OmniWeb
4.0.x doesn't use this method (it has a separate launcher app which is
kind of a hack) but the 4.1 sneaky peek releases do it the right way.
You might also want to "man dyld" to see some useful options for
debugging this kind of thing. otool is also a useful command for finding
out about framework/library dependencies. (Take a look at the
prebinding release notes--there are some useful otool examples there.)
--
Kurt Revis
email@hidden