]> git.ipfire.org Git - thirdparty/glibc.git/blob - elf/ltglobmod2.c
Update.
[thirdparty/glibc.git] / elf / ltglobmod2.c
1 #include <dlfcn.h>
2 #include <stdio.h>
3 #include <stdlib.h>
4
5 extern int bar (void);
6
7 int
8 foo (void)
9 {
10 void *h;
11 int res;
12
13 /* Load ltglobalmod1 in the global namespace. */
14 h = dlopen ("ltglobmod1.so", RTLD_GLOBAL | RTLD_LAZY);
15 if (h == NULL)
16 {
17 printf ("%s: cannot open %s: %s",
18 __FUNCTION__, "ltglobmod1.so", dlerror ());
19 exit (EXIT_FAILURE);
20 }
21
22 /* Call bar. This is undefined in the DSO. */
23 puts ("about to call `bar'");
24 fflush (stdout);
25 res = bar ();
26
27 printf ("bar returned %d\n", res);
28
29 dlclose (h);
30
31 return res != 42;
32 }