This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
libobjc/1727: Invoking methods of instances created with @protocol
- To: gcc-gnats at gcc dot gnu dot org
- Subject: libobjc/1727: Invoking methods of instances created with @protocol
- From: michael dot scheibler at onevision dot de
- Date: 22 Jan 2001 13:00:15 -0000
- Reply-To: michael dot scheibler at onevision dot de
>Number: 1727
>Category: libobjc
>Synopsis: Invoking methods of instances created with @protocol
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Jan 22 05:06:00 PST 2001
>Closed-Date:
>Last-Modified:
>Originator: michael.scheibler@onevision.de
>Release: unknown-1.0
>Organization:
>Environment:
mingw32-nt-i586
>Description:
When I create an instance of my protocol using the statement
@protocol(TestProtocol), I can't invoke any method of it.
I found out, that the isa pointer is not set correctly.
However, if I have an implementation of the protocol inside the same bundle, the problem doesn't occur.
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/plain; name="compare.m"
Content-Disposition: inline; filename="compare.m"
#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;
}