I am trying GNUstep. If it's working well, I'll try to make a website with it.
Anyway, I am stuck from at first. GNUstep NSRunLoop
implementation doesn't seem to work well.
Here's my code.
#import <Foundation/Foundation.h>
@interface AAA : NSObject
- (void)test1:(id)s;
@end
@implementation AAA
- (void)test1:(id)s
{
NSLog(@"%@", s);
}
- (void)dealloc
{
NSLog(@"DEALLOCED!!");
}
@end
int main(int argc, const char * argv[])
{
@autoreleasepool
{
AAA* aaa = [[AAA alloc] init];
[[NSNotificationCenter defaultCenter] addObserver:aaa selector:@selector(test1:) name:NSFileHandleDataAvailableNotification object:nil];
[[NSFileHandle fileHandleWithStandardInput] waitForDataInBackgroundAndNotify];
[[NSRunLoop currentRunLoop] run];
}
return 0;
}
I built this code with this command.
clang -v
EE_GNUSTEP_OPTS="-MMD -MP -DGNUSTEP -DGNUSTEP_BASE_LIBRARY=1 -DGNU_RUNTIME=1 -DGNUSTEP_BASE_LIBRARY=1 -fno-strict-aliasing -fexceptions -fobjc-exceptions -D_NATIVE_OBJC_EXCEPTIONS -D_NONFRAGILE_ABI -pthread -fPIC -Wall -DGSWARN -DGSDIAGNOSE -Wno-import -g -fgnu-runtime -fconstant-string-class=NSConstantString"
EE_BUILD_OPTS="-I/usr/local/include -L/usr/local/lib -lc -lobjc -lgnustep-base -fblocks -fobjc-arc -fobjc-abi-version=3"
alias OBJCC="clang $EE_GNUSTEP_OPTS $EE_BUILD_OPTS"
OBJCC *.m
Under OSX, the program doesn't quit, and just keep running the run-loop. It worked equally under GNUstep on FreeBSD if I don't use ARC. If I enable ARC the program quit immediately. I have no idea why that doesn't work only when ARC is enabled. Why does it quits immediately?
Here's the component versions I used:
svn co http://svn.gna.org/svn/gnustep/libs/libobjc2/releases/1.7 libobjc2-1.7 &
svn co http://svn.gna.org/svn/gnustep/tools/make/tags/make-2_6_5 make-2_6_5 &
svn co http://svn.gna.org/svn/gnustep/libs/base/tags/base-1_24_5 base-1_24_5 &