• 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: eval?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: eval?


  • Subject: Re: eval?
  • From: Sherm Pendley <email@hidden>
  • Date: Mon, 31 May 2010 13:25:11 -0400

On Mon, May 31, 2010 at 1:11 PM, Louis-Philippe <email@hidden> wrote:
> Correct me if I am wrong, but there is no way in objective-c to do a runtime
> string execution for which the responding object is not an Objective-C
> class?
>
> like, if I have a c++ lib I would like to call from within an Objective-c
> class, assuming a call like:
>
> const char * retValue = MyExtLib::ExtLibSymbol;
>
> I would like to be able to dispatch dynamically, something like:
>
> const char * retValue = eval( [NSString
> stringWithFormat@"MyExtLib::%@",symbolString]
> );
>
> any thoughts on making this possible?

There's dlopen() for loading the library, dlsym() for getting pointers
to functions in the library, and libffi for building an appropriate
stack frame and making the call at run time.

The biggest problem would be dealing with C++'s name-mangling.

sherm--

--
Cocoa programming in Perl:
http://www.camelbones.org
_______________________________________________

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: 
 >eval? (From: Louis-Philippe <email@hidden>)

  • Prev by Date: Re: Which color space?
  • Next by Date: Re: dynamic resolution
  • Previous by thread: eval?
  • Next by thread: Re: eval?
  • Index(es):
    • Date
    • Thread