Created
February 24, 2013 00:11
-
-
Save starbugs/5021960 to your computer and use it in GitHub Desktop.
Just a small program to test Objective-C blocks, GCD and GUI on Ubuntu
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// main.m | |
// Just a little test case for Objective-C 2.0 on Ubuntu | |
// | |
// Created by Tobias Lensing on 2/22/13. | |
// More cool stuff available at blog.tlensing.org. | |
// | |
#import <Foundation/Foundation.h> | |
#import <AppKit/AppKit.h> | |
#import <dispatch/dispatch.h> | |
int main(int argc, const char * argv[]) | |
{ | |
@autoreleasepool { | |
int multiplier = 7; | |
int (^myBlock)(int) = ^(int num) { | |
return num * multiplier; | |
}; | |
NSLog(@"%d", myBlock(3)); | |
dispatch_queue_t queue = dispatch_queue_create(NULL, NULL); | |
dispatch_sync(queue, ^{ | |
printf("Hello, world from a dispatch queue!\n"); | |
}); | |
dispatch_release(queue); | |
} | |
@autoreleasepool { | |
[NSApplication sharedApplication]; | |
NSRunAlertPanel(@"Test", @"Wow it works!", @"OK", nil, nil); | |
} | |
return 0; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment