[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: GWorkspace porting troubles
From: |
Enrico Sersale |
Subject: |
Re: GWorkspace porting troubles |
Date: |
Tue, 30 Oct 2001 01:43:42 +0200 (EET) |
On Mon, 29 Oct 2001, Adam Fedor wrote:
> LHelldorf@kabel.de wrote:
>
> >
> > GWorkspace.m: In function `+[GWorkspace gworkspace]':
> > GWorkspace.m:92: `gnustep_global_lock' undeclared (first use in this
> > function)
> > GWorkspace.m:92: (Each undeclared identifier is reported only once
> >
> > gnustep_global_lock is defined in NSObject.h (line 178: GS_EXPORT
> > NSRecursiveLock *gnustep_global_lock;) and initialized in NSObject.m (line
> > 603: gnustep_global_lock = [[NSRecursiveLock alloc] init];). Then
> > GS_EXPORT also doesn't exist in Cocoa.
> > How do I come out of this situation? How do I "bolt" those GNUstep
> > extensions onto Cocoa's NSObject?
> >
>
>
> Um, personnally I don't think GWorkspace should be using
> gnustep_global_lock. It's really something that should be exclusive to
> the gnustep libraries. As they say, get your own d*mn lock :-)
>
> Anyway, an app that wants to be cross-platform shouldn't use anything
> within the #ifndef NO_GNUSTEP/#endif sections.
I need a shared istance of the principal class of gworkspace to be
accessible through all the app.
So, since, when I started all the stuff, I was not thinking at any kind of
port :-) , I've used this method, (probably copied from a library class):
static GWorkspace *gworkspace = nil;
@implementation GWorkspace
+ (GWorkspace *)gworkspace
{
if (gworkspace == nil) {
[gnustep_global_lock lock];
if (gworkspace == nil) {
gworkspace = (GWorkspace*)NSAllocateObject(self, 0,
NSDefaultMallocZone());
}
[gnustep_global_lock unlock];
}
return gworkspace;
}
I'm going to release a new version, with a recycler and more.
If somebody suggest the right solution, I'll put in the new release.
Re: GWorkspace porting troubles, LHelldorf, 2001/10/29