* SUPPORTED (SUPPORTED-LOCALES): Add as_IN.UTF-8 and or_IN.UTF-8.
[glibc.git] / elf / unload5.c
blob0555052ce87b62845f87cdea8692d9cf9092bc00
1 #include <dlfcn.h>
2 #include <stdio.h>
4 int
5 main (void)
7 void *g = dlopen ("unload3mod1.so", RTLD_GLOBAL | RTLD_NOW);
8 void *h = dlopen ("unload3mod2.so", RTLD_GLOBAL | RTLD_NOW);
9 if (g == NULL || h == NULL)
11 printf ("dlopen unload3mod{1,2}.so failed: %p %p\n", g, h);
12 return 1;
14 dlopen ("unload3mod4.so", RTLD_GLOBAL | RTLD_NOW);
15 dlclose (h);
16 dlclose (g);
18 g = dlopen ("unload3mod3.so", RTLD_GLOBAL | RTLD_NOW);
19 h = dlopen ("unload3mod4.so", RTLD_GLOBAL | RTLD_NOW);
20 if (g == NULL || h == NULL)
22 printf ("dlopen unload3mod{3,4}.so failed: %p %p\n", g, h);
23 return 1;
26 int (*fn) (int);
27 fn = dlsym (h, "bar");
28 if (fn == NULL)
30 puts ("dlsym failed");
31 return 1;
34 int val = fn (16);
35 if (val != 24)
37 printf ("bar returned %d != 24\n", val);
38 return 1;
41 return 0;