help-gnustep
[Top][All Lists]
Advanced

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

Re: Categories and selector


From: Nicola Pero
Subject: Re: Categories and selector
Date: Mon, 25 Nov 2002 17:11:03 +0000 (GMT)

> 
> Le lundi, 25 nov 2002, ? 12:19 Europe/Paris, Nicola Pero a ?crit :
> 
> >> The only reason I see for that is that the category is not added to 
> >> the
> >> class object at runtime... I wonder why this program works on MacOSX
> >> and GNUStep/Solaris, but not on GNUstep/Linux ?
> >
> > It sounds strange.  Can you provide a self-contained, but short/simple,
> > testcase, which I can use to reproduce the problem on my GNU/Linux ?
> 
> I tried but... I was not able to reproduce this :(
> 
> If you want to try the program that generates the exception, it is 
> available at
> <http://people.type-z.org/seb/bordel/Piranhas2-0.0.6.tar.gz>.
> 
> > Which version of gcc/libobjc are you using ?
> 
> gcc is 3.04
> libobjc is bundled with gcc 3.04 but also available as 1.0 under 
> /usr/lib.
> 
> Maybe if you manage to execute my program (PingPongDemo) without the 
> "PingPongDemo: Uncaught exception NSInvalidArgumentException, reason: 
> PingPongAgent(instance) does not recognize helloWorld" exception, this 
> would mean that I have a broken gcc/libobjc install.

Thanks.

That looks a lot like a bug in loading categories which was fixed in the
libobjc shipped with gcc 3.1.

As a matter of fact, I tried compiling and running with gcc 2.91.66, and
got the problem you report; then I tried compiling and running with gcc
3.3 prerelease, and the problem went away.

So you should upgrade your compiler ... well you've got another option to
go, which is to work around the bug.  The bug is that in rare
circumstances, the loading algorithm is skipping some categories.  You got
into one of those rare circumstances. :-)

You can add a fake category before the one giving you the loading
problem.  libobjc will skip that category instead of yours. :-)

I tried adding 

@implementation PAgent (FakeCategory)
- (void) xyzuqiuiwenr {}
@end

in your source code, just before your

@implementation PAgent ( MessageCapacity )

and now for me it works with GCC 2.91.66 as well. :-)

I'd suggest to apply this workaround, because in this way your users can
use your software even if they don't have GCC >= 3.1.  In the long term,
everyone will be using future versions of GCC, and the problem will go
away and you'll eventually remove the hack.


Hope that helps, and thanks for reporting your problems ! :-)





reply via email to

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