Skip to content

Instantly share code, notes, and snippets.

@mysteriouspants
Created July 6, 2011 21:28
Show Gist options
  • Save mysteriouspants/1068374 to your computer and use it in GitHub Desktop.
Save mysteriouspants/1068374 to your computer and use it in GitHub Desktop.
Runtime Funs!
// compile with:
// clang -framework Foundation test.m
// run with:
// ./a.out
#import <objc/runtime.h>
#import <Foundation/Foundation.h>
#include <stdio.h>
int main(int argc, char *argv[])
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
struct objc_method_description m =
protocol_getMethodDescription(@protocol(NSCoding), @selector(encodeWithCoder:), YES, YES);
printf("s: %s \n", @selector(foobar:));
printf("m: %s, %s \n", m.name, m.types);
[pool release];
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment