Is NSMethodSignature compiler-dependent?
Is NSMethodSignature compiler-dependent?
- Subject: Is NSMethodSignature compiler-dependent?
- From: Ingmar J Stein <email@hidden>
- Date: Fri, 13 May 2005 06:47:44 +0200
Hi all,
the following test programs illustrate a problem I'm having with
Distributed
Objects when the client and server have been compiled with different gcc
versions.
I don't know if attachments are allowed on this list, so I will
include the
source files inline.
server.m:
#import <Foundation/Foundation.h>
@protocol TestProtocol
- (oneway void) echo:(bycopy in NSString *)message;
@end
@interface TestServer : NSObject <TestProtocol>
@end
@implementation TestServer
- (void) echo:(NSString *)message {
NSLog(@"Message: %@", message);
}
@end
int main (int argc, const char *argv[]) {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSConnection *connection = [NSConnection defaultConnection];
TestServer *rootObject = [[TestServer alloc] init];
[connection setRootObject:rootObject];
if (![connection registerName:@"TestServer"]) {
NSLog(@"WARNING: could not register TestServer");
}
[[NSRunLoop currentRunLoop] run];
[rootObject release];
[pool release];
return EXIT_SUCCESS;
}
EOF
client.m:
#import <Foundation/Foundation.h>
@protocol TestProtocol
- (oneway void) echo:(bycopy in NSString *)message;
@end
int main (int argc, const char *argv[]) {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSConnection *connection = [NSConnection
connectionWithRegisteredName:@"TestServer" host:nil];
if (connection) {
NS_DURING
NSDistantObject *theProxy = [connection rootProxy];
[theProxy setProtocolForProxy:@protocol(TestProtocol)];
id<TestProtocol> testProxy = (id<TestProtocol>)theProxy;
[testProxy echo:@"Hello World!"];
NS_HANDLER
NSLog(@"TestClient: exception: %@", localException);
NS_ENDHANDLER
} else {
NSLog(@"TestClient: could not create connection");
}
[pool release];
return EXIT_SUCCESS;
}
EOF
Makefile:
all: client server
client:
gcc-3.3 -o client client.m -framework Foundation
server:
gcc-4.0 -o server server.m -framework Foundation
clean:
rm -f client server
EOF
The following happens when I run the test programs:
$ ./server&
[1] 2917
$ ./client
2005-05-13 06:35:26.699 server[2917]
_preInitWithCoder:signature:valid:wireSignature:target:selector:argCount
: incompatible method params: got NSMethodSignature: types=Vv@:nO@
nargs=3 sizeOfParams=160 returnValueLength=0; want
NSMethodSignature: types=Vv@:On@ nargs=3 sizeOfParams=160
returnValueLength=0;
As you can see, the NSMethodSignature of the echo method differs in
the type
signature: Vv@:nO@ vs Vv@:On@
However, the order of the flags nO (in, bycopy) should not be relevant.
What can I do to work around the problem?
Ingmar
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden