This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
libobjc: @protocol doesn't retrieve valid class pointer
- To: gcc-bugs at gcc dot gnu dot org
- Subject: libobjc: @protocol doesn't retrieve valid class pointer
- From: Michael Scheibler <michael dot scheibler at onevision dot de>
- Date: Mon, 22 Jan 2001 13:52:16 +0100
- Organization: OneVision Vertriebsgesellschaft mbH
- Reply-To: michael dot scheibler at onevision dot de
When I create an instance of my protocol using the statement
@protocol(TestProtocol), I can't invoke any method of it. As I ran
through the code using gdb, I found out, that the class pointer of this
structure is not set correctly.
However, if I have an implementation of the protocol inside the same
bundle, the problem doesn't occur.
Michael
#include <Foundation/Foundation.h>
@protocol TestProtocol
- (void) doSomething;
@end
/** Code crashes without this implementation
@interface Test : NSObject <TestProtocol>
@end
@implementation Test
- (void) doSomething
{
printf("Did Something\n");
}
@end
**/
int main(int argc, char* argv[])
{
Protocol *pr;
pr = @protocol(TestProtocol);
printf("Protocol name: %s\n", [pr name]);
return 0;
}