Re: Returning values from objc_msgSend etc
Re: Returning values from objc_msgSend etc
- Subject: Re: Returning values from objc_msgSend etc
- From: "Sherm Pendley" <email@hidden>
- Date: Sat, 1 Mar 2008 04:22:26 -0500
On Fri, Feb 29, 2008 at 2:46 PM, Greg Parker <email@hidden> wrote:
>
> When in doubt, write Objective-C code that returns the type you want,
> compile it, and use whichever function the generated assembly code
> chose.
What's your advice about what to do when the choice must be made at runtime?
I'm using libffi. Does it know about the implicit first argument for struct
returns? That is, do I take the moral equivalent of the suggestion in
objc/objc-runtime.h, call objc_msgSend_stret() using a struct return type
and leave the argument shuffling for ffi to handle? Or, do I call it as
declared, with a void return type, setting up the return pointer argument
myself and disregarding the comment in the header file?
Also, do you know what, if any, type promotions are relevant, and whether
libffi automatically handles them?
I'm (slowly) updating CamelBones, replacing libffcall with libffi. Ffcall is
fairly limited in its structure handling - structure components have to be
known at compile time, whereas libffi's struct definition metadata can be
assembled at run time. That capability is a must, if I'm to be able to read
.bridgesupport metadata, hence the switch.
sherm--
_______________________________________________
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