Skip to content

Instantly share code, notes, and snippets.

@lynxluna
Created February 9, 2011 21:46
Show Gist options
  • Save lynxluna/819372 to your computer and use it in GitHub Desktop.
Save lynxluna/819372 to your computer and use it in GitHub Desktop.
Some hello world using foundation on C and objective-c
id pool=objc_msgSend((id)NSClassFromString(CFSTR("NSAutoreleasePool")), NSSelectorFromString(CFSTR("alloc")));
pool=objc_msgSend(pool, NSSelectorFromString(CFSTR("init")));
id bundle=objc_msgSend((id)NSClassFromString(CFSTR("NSBundle")), NSSelectorFromString(CFSTR("alloc")));
bundle=objc_msgSend(bundle, NSSelectorFromString(CFSTR("initWithPath:")), bundlePath);
objc_msgSend(bundle, NSSelectorFromString(CFSTR("load")));
objc_msgSend(bundle, NSSelectorFromString(CFSTR("autorelease")));
objc_msgSend(pool, NSSelectorFromString(CFSTR("release")));
NSAutoReleasePool *pool = [[NSAutoReleasePool alloc] init];
NSBundle *bundle = [[NSBundle alloc] initWithPath: bundlePath];
[bundle load];
[bundle autorelease];
[pool release];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment