lewicki@beach.csulb.edu (Dave Lewicki) (03/06/91)
Objective-C on the Next uses the C function objc_Send() to do the actual messaging. Next says to NEVER use this function in your own code. However, I need to get a pointer to a message. 1. Is this used in all implementations of Objective-C? Would using this function be portable? 2. Would use of this function be upward compatible with future releases of NextStep? please email responses - thanx D.L. P.S. I think that Objective-C and C++ go great together!
scott@erick.gac.edu (Scott Hess) (03/06/91)
In article <1991Mar5.165819.27088@beach.csulb.edu> lewicki@beach.csulb.edu (Dave Lewicki) writes: Objective-C on the Next uses the C function objc_Send() to do the actual messaging. Next says to NEVER use this function in your own code. However, I need to get a pointer to a message. And? What does having to get a pointer to a message have to do with objc_Send()? If you mean "pointer to a message" in terms of a method specification (a SEL variable), just say [anObject perform:aSel]. If you mean in terms of a pointer to the actual function involved (there is one back in there somewhere :-), here's a piece of example code which will work on List's of objects guarenteed to contain only on type of instance: @implementation List (ListStuff) - fastMakeObjectsPerform:(SEL)aSel { int i=[self count]; if( i) { IMP func=[[self objectAt:0] methodFor:aSel]; while( i--) func( [self objectAt:i], aSel); } return self; } @end If you are _really_ concerned about speed, there, then you could also skip the objectAt: and count calls and go directly to the List internals. Hey, there are all kinds of needs, right? If I've either totally missed the point, or you need elaboration, feel free to contact me via email. I am: -- scott hess scott@gac.edu Independent NeXT Developer GAC Undergrad <I still speak for nobody> "Tried anarchy, once. Found it had too many constraints . . ." "I smoke the nose Lucifer . . . Bannana, banna."