+load for Darwin improved

This commit is contained in:
Glenn Ganz 2011-03-15 17:58:41 +01:00
parent f826ee093d
commit c8763a11d0
4 changed files with 20 additions and 1 deletions

View File

@ -123,7 +123,9 @@ BOOL NSObjectIsKindOfClass(id object,Class kindOf) {
+ (void)poseAsClass:(Class)aClass
{
NSAutoreleasePool * pool = [NSAutoreleasePool new];
NSUnimplementedMethod();
[pool release];
}

View File

@ -33,4 +33,5 @@ typedef struct {
OBJCArray *moduleArray;
} OBJCObjectFile;
OBJC_EXPORT void OBJCQueueModule(OBJCModule *module);
OBJC_EXPORT void OBJCQueueModule(OBJCModule *module);
OBJC_EXPORT void OBJCSendLoadMessages();

View File

@ -410,6 +410,16 @@ static void OBJCSymbolTableRegisterClasses(OBJCSymbolTable *symbolTable){
OBJCRegisterClass(class);
OBJCAddToUnResolvedClasses(class);
#ifdef APPLE
if(strcmp(class_getName(class), "NSConstantString") == 0) {
memcpy(&_NSConstantStringClassReference, cls, sizeof(_NSConstantStringClassReference));
}
if(strcmp(class_getName(class), "NSDarwinString") == 0) {
memcpy(&__CFConstantStringClassReference, cls, sizeof(_NSConstantStringClassReference));
}
#endif
if(strcmp(class_getName(class), "Protocol") == 0) {
// Fix protocol classes where isa is not yet set. This is the case for all
// classes loaded before Protocol class is loaded.
@ -542,7 +552,10 @@ void OBJCQueueModule(OBJCModule *module) {
#endif
OBJCLinkClassTable();
#ifndef __APPLE__
OBJCSendLoadMessages();
#endif
}
void OBJCResetModuleQueue(void) {

View File

@ -161,5 +161,8 @@ void OBJCRegisterModule_Darwin(const char * name)
// Override the compiler version of the class
//objc_addClass(&_NSConstantStringClassReference);
OBJCSendLoadMessages();
}