Re: Which flavor of objc_msgSend for NSSize return
Re: Which flavor of objc_msgSend for NSSize return
- Subject: Re: Which flavor of objc_msgSend for NSSize return
- From: Sherm Pendley <email@hidden>
- Date: Sat, 12 May 2007 00:26:43 -0400
On May 11, 2007, at 11:40 PM, Greg Parker wrote:
Sherm Pendley wrote:
When I call objc_msgSend_stret() in CamelBones, I call it as
documented in the runtime reference, returning the struct by
reference in the first argument. It's much simpler, with no need
for the typecast.
Never call any objc_msgSend function without casting to an
appropriate function pointer type.
In CamelBones, I'm talking about a language bridge function that
takes parameters from Perl's call stack and uses ffcall to build the
call stack for objc_msgSend*(). It's not a simple static function
call with the argument and return types known at compile time. While
your advice is undoubtedly sound for most situations, a compile-time
cast isn't an option when the argument and return types aren't known
until run time.
In fact, ffcall itself isn't very flexible with respect to structure
types that are unknown at compile time. I chose it many moons ago,
because at the time Fink and DarwinPorts didn't yet exist; the only
way to obtain libffi was to build my own copy of GCC - not an
attractive prospect. I think I'll have to revisit that decision now...
sherm--
Web Hosting by West Virginians, for West Virginians: http://wv-www.net
Cocoa programming in Perl: http://camelbones.sourceforge.net
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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