• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: calling method via IMP that returns non id type - compiler warning
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

References: 
 >Re: calling method via IMP that returns non id type - compiler warning (From: "b.bum" <email@hidden>)

  • Prev by Date: Re: Self contained MetaPackages
  • Next by Date: Add NSString into an NSImage
  • Previous by thread: Re: calling method via IMP that returns non id type - compiler warning
  • Next by thread: new to memory mgmt
  • Index(es):
    • Date
    • Thread