6 #import <Foundation/Foundation.h>
12 main(int argc, char **argv)
14 int (*function)(const void *data, size_t len) = NULL;
17 err(1, "%s library funcation", getprogname());
19 char *libraryName = argv[1];
20 char *funcationName = argv[2];
23 library = dlopen(libraryName, RTLD_NOW);
25 errx(1, "failed to open %s: %s", libraryName, dlerror());
28 function = dlsym(library, funcationName);
30 errx(1, "didn't find %s in %s: %s", funcationName, libraryName, dlerror());
37 NSError *error = NULL;
38 NSData *data = [NSData dataWithContentsOfFile:[NSString stringWithUTF8String:argv[0]] options:0 error:&error];
40 NSLog(@"%s: %@", argv[0], error);
42 function([data bytes], [data length]);