Rewritten objc.m to use Objective-C objects (NSData, NSString and NSFileHandle) and provided build instructions using clang on both OS X and Linux.
This commit is contained in:
24
o/objc.m
24
o/objc.m
@@ -1,7 +1,21 @@
|
||||
#import <Cocoa/Cocoa.h>
|
||||
/*
|
||||
Build on OS X:
|
||||
clang -framework Foundation -fobjc-arc objc.m -o objc
|
||||
|
||||
Build on Linux with GNUstep:
|
||||
clang `gnustep-config --objc-flags` `gnustep-config --base-libs` -fobjc-nonfragile-abi -fobjc-arc objc.m -o objc
|
||||
*/
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
NSLog(@"Hello, World!\n");
|
||||
return 0;
|
||||
}
|
||||
@autoreleasepool
|
||||
{
|
||||
NSFileHandle *_stderr = [NSFileHandle fileHandleWithStandardError];
|
||||
NSString *string = @"hello, world\n";
|
||||
NSData *data = [string dataUsingEncoding:[NSString defaultCStringEncoding]];
|
||||
[_stderr writeData:data];
|
||||
}
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
Reference in New Issue
Block a user