James Bielman wrote:
>> Are you sure that is varargs or do you mean polymorphism, i.e. each
>> different signature has a different entry point (address), but they
>> are still refered under an identical name?
>No, all Objective-C methods are called via the varargs function
>objc_msgSend --- see:
>http://developer.apple.com/documentation/Cocoa/Conceptual/Objec
>tiveC/LanguageOverview/chapter_4_section_6.html

I see. Hairy problem.  I've never seen any of the CL FFI's deal with varargs 
(but it's >10 years last I looked and evaluated cmucl, Lucid, Allegro, akcl).
I'll suggest the maintainer of the FFCALL package (Bruno Haible) look into this.

Here's some other message about varargs vs. fully typed function calls that 
shows that I'm hopefully not spreading FUD when I say there can be problems:
http://gcc.gnu.org/ml/gcc/2004-06/msg01019.html
"It's assuming that the calling conventions for a varargs function and a 
non-varargs function are the same, and that's not necessarily true on all 
platforms."

Maybe that's not a problem in practice, because the systems where it's used 
nevertheless (i.e. in your case it must be an Apple OSX with PowerPC) could 
behave regularly. But that's just a conjecture.

Regarding objc_msgSend, the Python people have similar problems (all other 
languages will, e.g. .NET, Perl, Haskell), and I found a mention of 
NSInvocation which might be usable. But that's just 10 minutes reading into the 
subject, you certainly know all this.

However, here's for 20 minutes of reading value:
http://lists.ximian.com/pipermail/cocoa-sharp/2004-June/000083.html
"C-style varargs that are not supported by .NET's pinvoke engine"
"...better idea. There is a 'objc_msgSendV' that allows to send messages with a 
va_list, making it possible to forward the stack."

Like I said in my previous post, don't attempt to interface to C varargs. Look 
out for *V (e.g. execv) functions instead!
I suggest you interface to objc_msgSendV instead.

I hope this helps,
        Jorg Hohle

I also found http://camelbones.sourceforge.net/ : Cocoa programming in Perl, 
maybe that site could also give ideas. BTW, Sherm Pendley uses Bruno's 
libffcall :)
http://www.codecomments.com/archive376-2005-6-504642.html
http://hoc.sourceforge.net is Haskell <-> ObjC
_______________________________________________
cffi-devel mailing list
cffi-devel@common-lisp.net
http://common-lisp.net/cgi-bin/mailman/listinfo/cffi-devel

Reply via email to