#include <stdio.h>
#include <string.h>
#include <dlfcn.h>
#include <mach-o/dyld.h>
extern struct mach_header __dso_handle;
int main(int argc, const char* argv[])
{
printf("[BEGIN] NSLookupSymbolInImage-basic\n");
NSSymbol sym = NSLookupSymbolInImage(&__dso_handle, "_main", NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR);
if ( sym == NULL ) {
printf("[FAIL] NSLookupSymbolInImage-basic _main\n");
return 0;
}
sym = NSLookupSymbolInImage(&__dso_handle, "_42hhg", NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR);
if ( sym != NULL ) {
printf("[FAIL] NSLookupSymbolInImage-basic _42hhg\n");
return 0;
}
printf("[PASS] NSLookupSymbolInImage-basic\n");
return 0;
}