Re: calling method via IMP that returns non id type - compiler warning
Re: calling method via IMP that returns non id type - compiler warning
- Subject: Re: calling method via IMP that returns non id type - compiler warning
- From: Ben Dougall <email@hidden>
- Date: Mon, 16 Feb 2004 12:54:29 +0000
On Monday, February 16, 2004, at 02:29 am, b.bum wrote:
Looking at the docs (searched google for "IMP
instanceMethodForSelector declaration"):
http://developer.apple.com/documentation/Cocoa/Reference/Foundation/
ObjC_classic/Classes/NSObject.html
And it would appear that you likely need a declaration like:
MyType *(*theMethodIMP)(id, SEL, unsigned);
Note the extra *. Isn't C fun?
no, not really. :)
ok, maybe IMPing isn't a good idea. but in anycase i couldn't get the
above line to work and this is what did work in the end, based on some
code in the link you pointed out:
.h:
extern MyType (*theMethodIMP)(id, SEL, unsigned);
.m:
MyType (*theMethodIMP)(id, SEL, unsigned) = nil;
and:
theMethodIMP = (MyType(*)(id, SEL, unsigned))[object
methodForSelector:@selector(theMethod:)];
thanks very much, ben.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.