gnustep-dev
[Top][All Lists]
Advanced

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

Re: can't use @protocol in +load


From: Jeremy Bettis
Subject: Re: can't use @protocol in +load
Date: Thu, 24 Jul 2003 15:24:53 -0500

Ok, I am replying to my own message.

There is a problem in gcc's @protocol handling.

The runtime has no information about protocols which are referenced by code
but not by classes in that module.

Here is some sample code that works with NeXT runtime and crashes with GNU
runtime.

#import <objc/Object.h>
#import <objc/Protocol.h>

@protocol Foo
- (void) foo;
@end

@interface A : Object
- (void) foo;
@end

@implementation A
- (void) foo
{
    printf("Protocol name = %s\n", address@hidden(Foo) name]);
}
@end

int main()
{
 A *a = [A new];
 [a foo];
}


Under gcc version 3.2 (mingw special 20020817-1) we get this symtab
 .align 4
__OBJC_SYMBOLS:
 .long 0
 .long 0
 .word 1
 .word 0
 .long __OBJC_CLASS_A
 .long 0


But using gcc version 2.7.2.1 for NeXT PDO gives this: ( I added comments)
 .align 4
__OBJC_SYMBOLS:
 .long 0 //sel_ref_cnt
 .long 0 //refs
 .word 1 //cls_def_cnt
 .word 0 //cat_def_cnt
 .long 0 //obj_defs
 .long 1 //proto_defs
 .long __OBJC_CLASS_A // defs
 .long __OBJC_PROTOCOL_Foo



I'd like to change gcc to use a symtab like NeXT's.  I know I am going to
have to patch both gcc and libobjc, which will be painful, where do I send
those patches where I can get some reasonable hope of them being accepted?





reply via email to

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