home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!rosie!NeXT.com
- From: sam_s@NeXT.com (Sam Streeper)
- Newsgroups: comp.sys.next.programmer
- Subject: Re: Pointers to functions in method definitions
- Message-ID: <6164@rosie.NeXT.COM>
- Date: 6 Jan 93 05:10:45 GMT
- References: <C0CAtI.KqM@knot.ccs.queensu.ca>
- Sender: news@NeXT.COM
- Reply-To: sam_s@NeXT.com
- Lines: 23
-
- alastair@hecate.phy.queensu.ca (A.B. McLean) writes:
- > I want to write a method that will accept a pointer to a C function.
-
-
- I would guess that this isn't directly possible; it looks like the Objective-C
- runtime doesn't have the ability to encode data of type function pointer.
-
- A couple of solutions might include passing the function pointer as an int
- pointer and then casting it to a function pointer, or to remove the function
- interface and pass a selector:
-
- - invokeThisMethod:(SEL) aMethod
- {
- [self perform: aMethod with:self];
-
- }
-
- If aMethod = @selector(foo:), this is roughly equivalent to [self foo:self].
-
- -sam
- --
- Opinions expressed herein are not those of my employer. They're not even
- mine. They're probably wrong besides. How did they get in here, anyway?
-