On Aug 11, 2005, at 12:41 AM, Nathaniel Gray wrote:
On Aug 10, 2005, at 6:56 PM, Sherm Pendley wrote:
On Aug 10, 2005, at 9:32 PM, Greg Parker wrote:
On Aug 10, 2005, at 6:02 PM, Nathaniel Gray wrote:
Is there any way to send float or double arguments to a method
designated at runtime? I've tried using objc_msgSendv, casting
it in various ways, and using -performv::, but nothing works.
Using objc_msgSendv() properly requires knowledge of your
platform's ABI. In particular, floating-point values must be
stored in a special place in the marg_list on PowerPC. objc-msg-
ppc.s notes some of the details.
I think those details are pretty well hidden by the marg_* macros
though. I've used method_getArgumentInfo() to get the offset of
the argument, and marg_setValue() to set it before calling
objc_msgSendv(). It worked fine with all sorts of types, including
floats and doubles.
Really? That's exactly what I'm doing. For a test case I wrote a
class OCOCTestCall with a class method
void test1_1mini() {
id nc = NSClassFromString(@"OCOCTestCall");
SEL sel = @selector(callFloat:);
marg_list margs;
int offset;
Method method;
const char* argtype;
union {float f; id i;} u;
As Greg said, go read objc-msg-ppc.s to understand why. The relevant
comment describes the true layout of margs, which has an array of 13
doubles at the beginning, which are animage of the floating point
parameter registers that must be set. In this case, the float
parameter x is supposed to be in fp0.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Objc-language mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/objc-language/email@hidden