[Prev] Thread [Next]  |  [Prev] Date [Next]

Re: Where to install custom framework to support a plug-in architecture? Erik Stainsby Mon Feb 13 21:00:41 2012

And I think I figured it out.  I added Copy Files and Copy Headers to the 
application Build Phases, dragged the framework into each and away she went.

~ Erik

On 2012-02-13, at 11:25 AM, Chris Hanson wrote:

> You can (and should) put it in the app bundle itself.
> Dynamic libraries (dylibs) on Darwin have an "Install Name" embedded into 
> them.  This Install Name is copied into anything that links the dylib, so it 
> can be located at run time by the dynamic loader (dyld).
> For system frameworks, this is the full path at which the framework lives - 
> for example, the dylib inside Foundation.framework has its full path as its 
> Install Name.
> For app frameworks, though, you can build them with an Install Name that will 
> cause them to be *searched for* at run time - one that starts with @rpath.
> For your framework's target, add this build setting to cause its Install Name 
> to have an @rpath prefix rather than the path from its INSTALL_PATH build 
> setting:
> In your application, you need to add an additional build setting that tells 
> dyld where to look up things that start with @rpath.  This is what the 
> Runpath Search Paths build setting is for.  Here's a simple setting for your 
> application:
> LD_RUNPATH_SEARCH_PATHS = @executable_path/../Frameworks
> This path will actually be built into your application binary, and will cause 
> your application to search for anything that starts with @rpath in its 
> embedded Frameworks directory.
> How does this affect your plug-ins?  Well, just like your application, your 
> plug-ins when linking against your framework will copy its Install Name into 
> them.  Then when you go to load a plug-in, dyld will fix up its linkage, 
> notice an Install Name that starts with @rpath, and then search for what 
> matches that @rpath -- and it'll find your framework!
> Why?  Because dyld always looks for @rpath matches in the Runpath Search 
> Paths of the executable for the running process -- which is your application! 
>  So you don't even need to specify any additional settings for your plug-ins, 
> just link them against the framework.
>  -- Chris
> On Feb 11, 2012, at 10:32 PM, Erik Stainsby wrote:
>> I'm trying to set up a lightweight custom framework against which I can hang 
>> a plugin architecture ~ dynamic bundle loading. 
>> Where would you place such a framework ?  I have been targeting 
>> ~/Library/Frameworks for the moment, but suspect there is a scheme which 
>> would allow this to all be contained with the Application Support context 
>> for my app or in the app bundle itself. But of course, the examples I can 
>> find all refer to XC3. I'm quite happy to read documentation if anyone can 
>> point me at something reasonably current.
>> Clues gratefully appreciated.
>> Erik
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Xcode-users mailing list      ([EMAIL PROTECTED])
>> Help/Unsubscribe/Update your Subscription:
>> https://lists.apple.com/mailman/options/xcode-users/cmh%40me.com
>> This email sent to [EMAIL PROTECTED]

Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      ([EMAIL PROTECTED])
Help/Unsubscribe/Update your Subscription:

This email sent to [EMAIL PROTECTED]