Update.
[glibc.git] / elf / reldepmod4.c
blob607f52baba83e96c5df08724b97901bdf340eaca
1 #include <dlfcn.h>
2 #include <stdio.h>
3 #include <stdlib.h>
5 int
6 call_me (void)
8 void *h;
9 int (*fp) (void);
10 int res;
12 h = dlopen ("reldepmod1.so", RTLD_LAZY);
13 if (h == NULL)
15 printf ("cannot open reldepmod1.so in %s: %s\n", __FILE__, dlerror ());
16 exit (1);
19 fp = dlsym (h, "foo");
20 if (fp == NULL)
22 printf ("cannot get address of foo in global scope: %s\n", dlerror ());
23 exit (1);
26 res = fp () - 42;
28 if (dlclose (h) != 0)
30 printf ("failure when closing h in %s: %s\n", __FILE__, dlerror ());
31 exit (1);
34 return res;