• 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: glenn andreas <email@hidden>
  • Date: Mon, 04 Jan 2010 18:24:41 -0600

On Jan 4, 2010, at 6:13 PM, Graham Cox wrote:

>
> On 05/01/2010, at 11:03 AM, 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.
>
> Functions are not the same, because a function's name is a necessary part of the runtime. A constant's name is just a convenience for the programmer and doesn't make it into the binary.
>
> There is no built-in standard way to do this - you're on your own.


CFBundle has routines for looking up both functions and data by name.  It does require you figure out what framework the symbol comes from (and then get the corresponding CFBundle), but it is doable.




Glenn Andreas                      email@hidden
The most merciful thing in the world ... is the inability of the human mind to correlate all its contents - HPL

_______________________________________________

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

  • Follow-Ups:
    • Re: Looking up a NSString constant at runtime
      • From: Mark Ritchie <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>)
 >Re: Looking up a NSString constant at runtime (From: Graham Cox <email@hidden>)

  • Prev by Date: Re: Looking up a NSString constant at runtime
  • Next by Date: Re: Do I need to download both XCode for both Mac & iPhone
  • 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