Update.
[glibc.git] / elf / reldepmod4.c
blobdcb503bba7deeead20c8dd97c50d92f6d8dd3581
1 #include <dlfcn.h>
2 #include <stdio.h>
3 #include <stdlib.h>
5 extern int call_me (void);
7 int
8 call_me (void)
10 void *h;
11 int (*fp) (void);
12 int res;
14 h = dlopen ("reldepmod1.so", RTLD_LAZY);
15 if (h == NULL)
17 printf ("cannot open reldepmod1.so in %s: %s\n", __FILE__, dlerror ());
18 exit (1);
21 fp = dlsym (h, "foo");
22 if (fp == NULL)
24 printf ("cannot get address of foo in global scope: %s\n", dlerror ());
25 exit (1);
28 res = fp () - 42;
30 if (dlclose (h) != 0)
32 printf ("failure when closing h in %s: %s\n", __FILE__, dlerror ());
33 exit (1);
36 return res;