• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Looking up a NSString constant at runtime
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >Re: Looking up a NSString constant at runtime (From: David Alter <email@hidden>)
 >Re: Looking up a NSString constant at runtime (From: Scott Ribe <email@hidden>)
 >Re: Looking up a NSString constant at runtime (From: David Alter <email@hidden>)

  • Prev by Date: Re: Looking up a NSString constant at runtime
  • Next by Date: Re: Looking up a NSString constant at runtime
  • Previous by thread: Re: Looking up a NSString constant at runtime
  • Next by thread: Re: Looking up a NSString constant at runtime
  • Index(es):
    • Date
    • Thread