libobjc/1727: Invoking methods of instances created with @protocol

michael.scheibler@onevision.de michael.scheibler@onevision.de
Mon Jan 22 05:06:00 GMT 2001


>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;
}


More information about the Gcc-bugs mailing list