Re: Delayed Framework Loading
Re: Delayed Framework Loading
- Subject: Re: Delayed Framework Loading
- From: Chris Suter <email@hidden>
- Date: Fri, 12 Jun 2009 19:40:33 -0700
Hi Dong,
On Fri, Jun 12, 2009 at 5:58 PM, Dong Feng<email@hidden> wrote:
> Thanks for the answer. It sounds correct, and I may give up to find a
> way to make linker simulate the CFURLCreateWithFileSystemPath().
>
> Actually I have a framework written by others, which does a lot
> initialization work at launch time. I wonder the initialization is
> done in an __attribute__((constructor)) function but I don't have the
> source code.
Constructor functions can obviously only run when the framework is
loaded. Your framework is currently being loaded at load time which is
why it’s running before main.
I’m not sure that what you want to do is directly possible in Leopard.
One possibility that might work for you would be to do the following.
Let’s say you only need this code to run when a particular menu item
is chosen. What you could do is put all code that uses this third
party framework in a separate bundle (or framework/dynamic library).
When the menu item is chosen, you load your bundle which would then
causes the third party framework to be loaded. The key here is
partitioning your code in such a way so that all references to your
third party framework are contained in one bundle and that you only
have a few entry points to your bundle.
By the way, -weak_framework won’t do what you want—it still causes the
framework to be loaded at load time. Also I don’t think
DYLD_BIND_AT_LAUNCH affects when a framework is loaded; it just
affects when binding is done, not loading.
If you have access to the Snow Leopard seeds, you might want to post
this question on the Snow Leopard forums (if you haven’t already).
Regards,
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