On Mon, May 31, 2010 at 1:11 PM, Louis-Philippe <[email protected]> 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 protected]) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [email protected]
