main.c revision 1.1
1#include <dlfcn.h>
2#include <stdio.h>
3
4int
5main()
6{
7        void *libaa, *libbb;
8	int flag = RTLD_NOW;
9
10        if ((libaa = dlopen("libaa.so", flag)) == NULL) {
11                printf("dlopen(\"libaa.so\", %d) FAILED\n", flag);
12                return 1;
13        }
14
15	if ((libbb = dlopen("libbb.so", flag)) == NULL) {
16		printf("dlopen(\"libbb.so\", %d) FAILED\n", flag);
17		return 1;
18	}
19
20        if (dlclose(libaa)) {
21                printf("dlclose(libaa) FAILED\n%s\n", dlerror());
22		return 1;
23        }
24
25        if (dlclose(libbb)) {
26                printf("dlclose(libbb) FAILED\n%s\n", dlerror());
27		return 1;
28        }
29
30        if ((libaa = dlopen("libaa.so", flag)) == NULL) {
31                printf("dlopen(\"libaa.so\", %d) FAILED\n", flag);
32                return 1;
33        }
34
35
36	return 0;
37}
38
39