Hi all,
I am sending this to gnustep-dev crossposted to gcc. Maybe this isn't
the right mailing list. See at the end of the post for a 40 line program
that exhibit the bad behavior.
Problem:
If a is a fault (ie: changes its isa pointer during forwardInvocation),
then:
[a method1:[a method2]]
fails (a does not recognize 'method1:'), while:
id o = [a method2];
[a method1:o];
works.
The code works correctly under Mac OS X.
Am I doing something horribly wrong ?
This is on gcc 3.2/mingw
Thanks for any help,
--fred
[EMAIL PROTECTED] /c/Dev/ObjcInvocations
$ shared_obj/invocation.exe
This one works:
method1
This one fails:
: Uncaught exception NSInvalidArgumentException, reason: B(instance)
does not recognize method1:
[EMAIL PROTECTED] /c/Dev/ObjcInvocations
$ gcc -v
Reading specs from
c:/GNUstepVersions/1.10.0/MinGW/bin/../lib/gcc-lib/mingw32/3.2/specs
Configured with: ../gcc/configure --with-gcc --with-gnu-ld --with-gnu-as
--host=mingw32 --target=mingw32 --prefix=/mingw --enable-threads
--disable-nls --enable-languages=f77,c++,objc,ada
--disable-win32-registry --disable-shared
Thread model: win32
gcc version 3.2 (mingw special 20020817-1)
$ uname -a
MINGW32_NT-5.0 FLEA 1.0.10(0.46/3/2) 2004-03-15 07:17 i686 unknown
makefile:
---------------------
MAKEFILE_NAME = GNUstepMakefile
include $(GNUSTEP_MAKEFILES)/common.make
TOOL_NAME = invocation
invocation_OBJC_FILES = Invocation.m
invocation_C_FILES =
invocation_CC_FILES =
invocation_HEADER_FILES =
invocation_OBJ_FILES =
ADDITIONAL_OBJCFLAGS =
ADDITIONAL_INCLUDE_DIRS = -I../SystemConfiguration
ADDITIONAL_LIB_DIRS = -L../SystemConfiguration
invocation_TOOL_LIBS = -lgnustep-base \
-lobjc
-include GNUstepMakefile.preamble
-include GNUstepMakefile.local
include $(GNUSTEP_MAKEFILES)/tool.make
-include GNUstepMakefile.postamble
---------------------
// Test for invocation problem
#import <Foundation/Foundation.h>
@interface A : NSProxy
@end
@interface B : NSObject
- (void)method1:(id)o;
- (id)method2;
@end
@implementation A
- init { return self; }
- (NSMethodSignature *)methodSignatureForSelector:(SEL)aSel { return [B
instanceMethodSignatureForSelector:aSel]; }
- (void)forwardInvocation:(NSInvocation *)anInvocation
{
isa = [B class];
[anInvocation invoke];
}
@end
@implementation B
- (id)method2 { return self; }
- (void)method1:(id)a { printf( "method1\n" ); }
@end
int main()
{
[[NSAutoreleasePool alloc] init];
B *theB0 = (B *)[[A alloc] init];
B *theB1 = (B *)[[A alloc] init];
printf( "This one works:\n" );
id o = [theB0 method2];
[theB0 method1:o];
printf( "This one fails:\n" );
fflush( stdout );
[theB1 method1:[theB1 method2]];
return 0;
}