Re: Sending messages without knowing number of args and types at compile time
Re: Sending messages without knowing number of args and types at compile time
- Subject: Re: Sending messages without knowing number of args and types at compile time
- From: Per Bull Holmen <email@hidden>
- Date: Tue, 2 Feb 2010 00:21:01 -0800 (PST)
Greg Parker wrote:
> On Feb 1, 2010, at 3:30 AM, Per Bull Holmen wrote:
> > I've been playing around with the idea of making a simple bridge
> > between Objective-C (running under Cocoa) and a script language.
/.../
> > I'd like to know whether there are any other ways than
> > NSInvocation to send a message without knowing arg types and numbers
> > at compile time. Non-hackish ways, that is.
> NSInvocation is the most architecture-neutral way to go.
>
> The best option outside NSInvocation is to use libffi to build calls
> to objc_msgSend.
Thanks. I forgot to mention one thing: It need not be perfect! Far from it... :) Just a simple tool, to facilitate letting a script (Lua) control a Cocoa application. Therefore, I just might go for making a few quick implementations for common argument- and return type combinations, and use NSInvocation for everything else. Then the user can install their own quick handlers for combinations that aren't covered yet.
But libffi seems like a very interesting option. Michael Ash mentions PyObjC and RubyCocoa, a quick check reveals that they both use libffi. Any further questions regarding this will be sendt on the objc mailing list. Thanks!
Per
_______________________________________________
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