• 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
How to define a method IMP for use as a C callback?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to define a method IMP for use as a C callback?


  • Subject: How to define a method IMP for use as a C callback?
  • From: Ken Tozier <email@hidden>
  • Date: Tue, 23 Mar 2004 03:59:19 -0500

I'm working with the ICA architecture and need to define an IMP for one
of my methods so it can be called as a C function by the ICA runtime. I
got it to the point where it does enter the method, when a camera is
plugged in, but the passed in parameter is always NULL. I'm sure I'm
just making a syntax error but can't figure it out. Could someone point
out what I'm doing wrong?

In my installNotification, the IMP is defined as follows:
- (void) installNotification
{
ICARegisterEventNotificationPB pb = {};

// create an IMP so the ICA architecture can call "handleNotification"
as a C function
typedef void (*HandleMessageIMP)(id, SEL,
ICARegisterEventNotificationPB *);
HandleMessageIMP doHandleMessage = (HandleMessageIMP)[self
methodForSelector:@selector(handleNotification:)];

// init the param block
pb.object = 0; // all objects
pb.notifyType = 0; // all types
pb.notifyProc = (ICACompletion) doHandleMessage;

// register handleNotification with the ICA architecture
if (ICARegisterEventNotification(&pb, NULL) == noErr);
{
NSLog(@"notification callback registered");
}
}

The "handleNotification method is...
- (void) handleNotification:(ICARegisterEventNotificationPB *) inPB
{
NSLog(@"entered handleNotification method %@", inPB);
// I get to here, but "inPB" is always NULL
}

Thanks

Ken
_______________________________________________
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.


  • Follow-Ups:
    • Re: How to define a method IMP for use as a C callback?
      • From: John Randolph <email@hidden>
    • Re: How to define a method IMP for use as a C callback?
      • From: "b.bum" <email@hidden>
  • Prev by Date: Re: NSLocalizedString() doesn't work
  • Next by Date: Re: NSRegion
  • Previous by thread: Re: NSRegion
  • Next by thread: Re: How to define a method IMP for use as a C callback?
  • Index(es):
    • Date
    • Thread