1 #include <stdio.h> // fprintf(), NULL
2 #include <stdlib.h> // exit(), EXIT_SUCCESS
5 #include <crt_externs.h>
6 #include <mach-o/dyld_priv.h>
10 int foo() { return 0; }
12 int alt_foo() { return 10; }
17 static const struct dyld_interpose_tuple sTable
[] = { {&alt_foo
, &foo
} };
20 __attribute__((constructor
))
24 dyld_dynamic_interpose((const struct mach_header
*)_NSGetMachExecuteHeader(), sTable
, 1);