Re: Sharing a Private Framework Between my App and QuickLook Plugin
Re: Sharing a Private Framework Between my App and QuickLook Plugin
- Subject: Re: Sharing a Private Framework Between my App and QuickLook Plugin
- From: Nick Nallick <email@hidden>
- Date: Wed, 21 Nov 2007 07:36:04 -0700
Chris,
This sounds like just the thing, except I can't limit my app to
Leopard (although obviously a Leopard-only QuickLook plug-in is
okay). Is there a way to do something similar with Tiger (and
optimally Panther too)?
Thanks,
Nick
On Nov 20, 2007, at 9:16 PM, Chris Hanson wrote:
On Nov 20, 2007, at 6:33 PM, Nick Nallick wrote:
Since my QuickLook plugin uses a lot of the code from my app I'm
interested in putting the common code into a private framework
(i.e., within the app bundle) and sharing it between the two.
However since I have to code the installation path into the
framework and the app and the plugin are at different directory
levels within the bundle I'm not sure how to set this up. I'm also
not sure about how to use a framework within a plugin since the
executable in this case is probably the QuickLook daemon.
One way you can do this is with a new Leopard dyld & linker feature
called "runpaths," short for "runtime search paths." They let you
take advantage of a collection of search paths built into your
binary when running against frameworks and libraries.
Here's how you'd take advantage of them. First, you would build
your framework to have an install name like this:
@rpath/MyFramework.framework/Versions/A/MyFramework
and install it into your application bundle's Contents/Frameworks
folder.
Then in your application target's build settings, specify the
following for the value of its "Runpath search paths" build setting:
@executable_path/../Frameworks
And in your application's QuickLook plug-in (which I'll assume is in
Contents/Library/QuickLook within your application), you can specify
the following for the value of its runpath search paths:
@loader_path/../../../../Frameworks
The @loader_path is replaced with the path to whatever *loads* a
binary; you can think of it like @executable_path for plug-ins and
frameworks.
The upshot of all of this is that your application's contents will
look something like this:
MyApplication.app/
Contents/
Frameworks/
MyFramework.framework
Library/
QuickLook/
MyApplicationQL.quicklook/
Contents/
MacOS/
MyApplicationQL
MacOS/
MyApplication
Resources/
...
And both your application binary and your QuickLook plug-in binary
will be able to find your framework via their embedded runtime-
location-relative search paths.
-- Chris
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden