This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Objective-C methodForSelector: support?


Axel von Kamp wrote:
> I'm using the egcs-Compiler from the RedHat 5.1 Linux to compile
> Objecive-C code. The Objective-C documentation on the Apple Site
> mentions the methodForSelector: method to get pointers to the procedures
> that implement the actual methods. It also says that methodForSelector:
> is provided by the run-time system and not by the Objective-C language
> itself.

More exactly it is provided by the Foundation library (although you
could consider the root class NSObject part of the runtime ..)

> When I try to use methodForSelector: I get a warning from the compiler
> saying that this method isn't implemented. Since it is only a warning
> the program compiles nevertheless but when I run it it crashes when
> methodForSelector: is called.

You probably have not installed a Foundation library. The Object class
delivered with the egcs runtime has a completly different interface than
NSObject, which is what you probably want.
Go to www.gnustep.org and get either the libFoundation library (my
choice) or the gstep-base library. Those libraries attempt to have a
similiar API like the Apple Foundation library and provide you the
NSObject class.

> So I wonder whether egcs supports methodForSelector: or something
> similar?

The runtime in egcs includes around 4 classes, Object, NXHashtable,
NXConstantString and something else. Those classes are also available
with Apple gcc, but aren't used in current OpenStep development
environments.
The Object aequivalent of methodForSelector: is methodFor:. The same is
for methods like 'respondsTo:'. You should take a look into Object.h to
get the full listing of supported methods.

> I'm also aware that egcs is not the actual run-time system so
> maybe I am asking this question on the wrong list; if so, where should I
> continue searching for an answer?

For Objective-C related questions is either comp.lang.objective-c or one
of the GNUstep discussion lists the best place.

Greetings
  Helge
--
MDlink online service center
http://www.mdlink.de/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]