Re: Looking up a NSString constant at runtime
Re: Looking up a NSString constant at runtime
- Subject: Re: Looking up a NSString constant at runtime
- From: David Duncan <email@hidden>
- Date: Mon, 4 Jan 2010 16:24:38 -0800
On Jan 4, 2010, at 4:03 PM, David Alter wrote:
> I can open a library and lookup a function by name using dlsym. These
> constants are EXTERN. It seams there should be away to look these up as
> well.
You should be able to look up extern variables manually, and you can use CFBundleGetDataPointerForName to do so (I'm not certain there is an NSBundle analog).
However, doing so is highly unusual unless you are loading plugins (and even then it is not common in Objective-C). So the question comes back to what are you trying to accomplish by doing this in the first place? You mentioned you are trying to get the value of a named constant, but without knowing anything but the name you can't be certain if you know what to do with that data constant in the first place (which is why the aforementioned function returns a void* and expects you to know what to do with it further).
--
David Duncan
Apple DTS Animation and Printing
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden