discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem with NSProcessInfo (?)


From: Chris B. Vetter
Subject: Re: Problem with NSProcessInfo (?)
Date: Tue, 20 May 2003 16:01:22 -0700

On Tue, 20 May 2003 12:00:13 -0700
"Chris B. Vetter" <chrisv@web4inc.com> wrote:
> If, as you say, that +load should not have ObjC code in them, then we
> have a serious problem porting Apple/Cocoa code to GNUstep.
> Take a look at some of Apple's Cocoa examples. There's a couple of
> examples that do just what I was trying to do -- create a subclass and
> use +load to have it +poseAs: super ... *bummer*

Alex suggested to use something like

  static void do_pose_as_and_stuff(void) __attribute__ ((constructor));

  static void do_pose_as_and_stuff(void)
  {
   //...
  }

  + (void) load
  {
    do_pose_as();
  }

However, I either get a "objc runtime: cannot find class Object" or the
same result as usual (the exception).

The documentation to gcc suggests to do something like

  main()
  {
    [Foobar load];
    //...
  }

which will trigger a [Foobar initialize] which could then do a poseAs:
however, if +load isn't specifically implemented (even if empty), you
will get a

  exception NSInvalidArgumentException, reason: Foobar(class) does not
  recognize load

Now, both

http://developer.apple.com/techpubs/macosx/Cocoa/Reference/Foundation/ObjC_classic/Classes/NSObject.html#load
http://www.channelu.com/NeXT/NeXTStep/3.3/nd/Foundation/Classes/NSObject.htmld/index.html

specify a +load for NSObject that returns self, and is supposed to be
overridden by subclasses -- however, base/Source/NSObject.m doesn't have
it, instead there's a +load in GSFFCallInvocation.m and/or
GSFFIInvocation.m

In fact, if you do a

  main()
  {
    [NSObject load];
  }

you will again get a

  exception NSInvalidArgumentException, reason: NSObject(class) does not
  recognize load

IMHO, according to the two links above, this would be wrong behaviour.

-- 
Chris




reply via email to

[Prev in Thread] Current Thread [Next in Thread]