5
typedef int (*testFNPtr)(int number);
7
int main (int argv, const char * argc[])
10
testFNPtr foofunc,foosym;
11
foosym = (testFNPtr)dlsym(RTLD_NEXT,"foo");
12
if (!foosym) printf("foosym RTLD_NEXT %s\n",dlerror());
13
foofunc = (testFNPtr)dlfunc(RTLD_NEXT,"foo");
14
if (!foofunc) printf("foofunc RTLD_NEXT %s\n",dlerror());
15
if ((void*)foosym != (void*)foofunc)
18
printf("RTLD_NEXT dlsym %x dlfunc %x\n",foosym,foofunc);
21
foosym = (testFNPtr)dlsym(RTLD_DEFAULT,"foo");
22
if (!foosym) printf("foosym RTLD_DEFAULT %s\n",dlerror());
23
foofunc = (testFNPtr)dlfunc(RTLD_DEFAULT,"foo");
24
if (!foofunc) printf("foofunc RTLD_DEFAULT %s\n",dlerror());
25
if ((void*)foosym != (void*)foofunc)
28
printf("RTLD_DEFAULT dlsym %x dlfunc %x\n",foosym,foofunc);
32
foosym = (testFNPtr)dlsym(RTLD_SELF,"foo");
33
if (!foosym) printf("foosym RTLD_SELF %s\n",dlerror());
34
foofunc = (testFNPtr)dlfunc(RTLD_SELF,"foo");
35
if (!foofunc) printf("foofunc RTLD_SELF %s\n",dlerror());
36
if ((void*)foosym != (void*)foofunc)
39
printf("RTLD_SELF dlsym %x dlfunc %x\n",foosym,foofunc);
42
if (!retCode) printf("Okay, this actually works, cool, I am happy\n");
43
else printf("Well, confirms a bug, makes me happy I was not wrong\n");
49
printf("foo %s %s",__FILE__,__LINE__);
b'\\ No newline at end of file'