Article View: comp.sys.next.programmer
Article #2194Re: Pointers to functions in method definitions
From: Sam Streeper
Date: Wed, 06 Jan 1993 05:10
Date: Wed, 06 Jan 1993 05:10
23 lines
1142 bytes
1142 bytes
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?
Technical Details
Message-ID:
<6164@rosie.NeXT.COM>Path:
arc1-ca.pugleaf.net!sparky!uunet!rosie!NeXT.comReferences:
<C0CAtI.KqM@knot.ccs.queensu.ca>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!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