Re: Getting a bundle to load symbols from the main app bundle
Re: Getting a bundle to load symbols from the main app bundle
- Subject: Re: Getting a bundle to load symbols from the main app bundle
- From: "Michael Ash" <email@hidden>
- Date: Sat, 8 Jul 2006 11:53:33 -0400
On 7/7/06, Damien Sorresso <email@hidden> wrote:
I've got a program that dynamically loads bundles, and I'd like those
bundles to load a symbol from the main application bundle.
Specifically, I'd like them to get a hold of the value of a global
debug variable.
I'm currently doing this from the loadable bundle.
__debug_level = (int *)CFBundleGetDataPointerForName(mainBundle, CFSTR
("__debug_level"));
But `CFBundleGetDataPointerForName()' returns NULL in this case. When
I do this call from the main application bundle, I get garbage. So
I'm wondering if my main app's symbols aren't getting exported properly.
If "__debug_level" is the actual variable name then the symbol name
will have an extra underscore prepended and so should be
"___debug_level". Otherwise if the name is actually "_debug_level"
then it sounds like it's not getting exported properly. You could
check using /usr/bin/nm which will save you from speculating.
Once you get the symbol to export properly, or verify that it is
exported properly already, you can bypass the whole manual symbol
lookup by setting your bundle's Bundle Loader. This will effectively
link the bundle against your application, allowing you to refer to
__debug_level directly using an extern, as well as access any other
symbols the application provides in a simpler fashion.
Mike
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden