gnustep-dev
[Top][All Lists]
Advanced

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

Re: incompatibilities between base and libobjc2


From: David Chisnall
Subject: Re: incompatibilities between base and libobjc2
Date: Wed, 8 Sep 2010 11:33:09 +0100

On 8 Sep 2010, at 10:40, Richard Frith-Macdonald wrote:

> On 6 Sep 2010, at 23:15, David Chisnall wrote:
>> 
>>> - NSObject.h uses a TypedStream class, not present in libobjc2. (for read: 
>>> and write: methods which are commented out). It looks like the TypedStream 
>>> stuff has been unused for a long time, maybe it can be removed from 
>>> NSObject?
>> 
>> Hmm, I thought these were conditionally compiled.  I think they can probably 
>> go - they're for legacy compatibility with some really ancient stuff - but I 
>> don't want to be the one to delete them...
> 
> I hid those methods and removed the include of the header.

Thanks.

>>> - Source/GSPrivate.h uses "struct objc_category" and "Category"  which are 
>>> not exposed by libobjc2. Not sure what to do for these..
>> 
>> 
>> They are not exposed because they are an implementation detail that should 
>> not be touched by anything except the compiler and the runtime.  Why does 
>> GNUstep think that it needs them?
> 
> The category type is used for one of the arguments to the callback function 
> called by the runtime when code is loaded from a bundle ... NSBundle needs 
> the callback to record the classes which have been loaded, but I think the 
> category argument is used only to determine whether a class or a category is 
> being loaded.  Possibly libobjc2 might want to implement some different 
> mechanism for letting NSBundle know what classes are loaded.

Hmm, I see.  libobjc2 only implements _objc_load_callback, not 
_objc_load_load_callback.  This is a bit confusing - I don't understand why I 
don't get a linker failure from the lack of _objc_load_load_callback.  There 
actually seem to be quite a few calls to functions that aren't in libobjc2 in 
GSPrivateLoadModule() - which is really confusing.  I'll take a look at this 
today.  

Looking at how GNUstep uses this callback, I think you can just use the 
single-argument version, since the second argument is always ignored if not 
NULL, and libobjc2 would not invoke the callback if the second argument were to 
be NULL.  

However, on any relatively modern system I think this callback is actually 
completely superfluous (not to mention fragile in a multithreaded environment). 
 I believe that the only place where this information is collected is in 
[NSBundle +bundleForClass:].  Rather than using the callback, we should 
probably use dladdr() to get the file name of the library containing the class 
and then construct the bundle from this.

David

-- Sent from my Apple II


reply via email to

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