]> git.saurik.com Git - apple/dyld.git/blob - unit-tests/test-cases/interpose-dynamic-lazy/foo.c
dyld-733.8.tar.gz
[apple/dyld.git] / unit-tests / test-cases / interpose-dynamic-lazy / foo.c
1 #include <stdio.h> // fprintf(), NULL
2 #include <stdlib.h> // exit(), EXIT_SUCCESS
3 #include <string.h>
4 #include <dlfcn.h>
5 #include <crt_externs.h>
6 #include <mach-o/dyld_priv.h>
7
8
9
10 int foo() { return 0; }
11
12 int alt_foo() { return 10; }
13
14
15
16
17 static const struct dyld_interpose_tuple sTable[] = { {&alt_foo, &foo} };
18
19
20 __attribute__((constructor))
21 void init()
22 {
23
24 dyld_dynamic_interpose((const struct mach_header*)_NSGetMachExecuteHeader(), sTable, 1);
25
26 }
27