_POSIX_C_SOURCE >= 200112L implies C99.
[glibc/history.git] / elf / unload7.c
blob198f7db286fb7740343929fee83e13fa92699324
1 #include <dlfcn.h>
2 #include <stdio.h>
4 int
5 main (void)
7 void *h = dlopen ("$ORIGIN/unload7mod1.so", RTLD_LAZY);
8 if (h == NULL)
10 puts ("dlopen unload7mod1.so failed");
11 return 1;
14 int (*fn) (void);
15 fn = dlsym (h, "foo");
16 if (fn == NULL)
18 puts ("dlsym failed");
19 return 1;
22 int ret = 0;
23 if (fn () == 0)
24 ++ret;
26 void *h2 = dlopen ("$ORIGIN/unload7mod2.so", RTLD_LAZY);
27 if (h2 == NULL)
29 puts ("dlopen unload7mod2.so failed");
30 return 1;
32 dlclose (h2);
34 if (fn () == 0)
35 ++ret;
37 dlclose (h);
38 return ret;