On Sat, Mar 1, 2008 at 8:00 AM, Greg Parker <[EMAIL PROTECTED]> wrote:
The right way to fix this is to add new API in libobjc: given an ffi_type, > return the correct objc_msgSend function pointer for that return type. I > filed the feature request for that today. Until then you'll still need to > handle that choice yourself. All of the required code is in libffi > somewhere, but there's no way for you to call it directly. libffi is open > source, so you could try digging through the implementation and copying the > code you want into your program. > Good idea. In the mean time, I've found a workaround I think I can live with. The call to ffi_prep_cif() will, among other things, properly initialize the size and alignment members of any relevant ffi_type structures. Getting the alignment right is the tricky part that I don't want to reinvent, but since ffi has already done that I can simply check the calculated size after calling ffi_prep_cif(), and compare that to sizeof(void*) to see if the return value will fit in a register. It's a hack, in that it hard-codes the "if it fits in a single register" rule, which would be better viewed as an implementation detail of libobjc. But it's good enough for now, and at least lets ffi handle the mechanics. I'll wrap this and the other selection rules into a function that I can easily replace with a call to the new API when (or if) that arrives. Thanks for the advice, sherm-- _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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]