1 | #include <dlfcn.h> |
---|---|
2 | #include <mcheck.h> |
3 | #include <stdio.h> |
4 | #include <stdlib.h> |
5 | |
6 | int |
7 | main (void) |
8 | { |
9 | int i; |
10 | void *h1, *h2; |
11 | |
12 | mtrace (); |
13 | |
14 | for (i = 0; i < 3; i++) |
15 | { |
16 | h1 = dlopen (file: "reldep4mod1.so", RTLD_NOW | RTLD_GLOBAL); |
17 | if (h1 == NULL) |
18 | { |
19 | printf (format: "cannot open reldep4mod1.so: %s\n", dlerror ()); |
20 | exit (status: 1); |
21 | } |
22 | h2 = dlopen (file: "reldep4mod2.so", RTLD_NOW | RTLD_GLOBAL); |
23 | if (h2 == NULL) |
24 | { |
25 | printf (format: "cannot open reldep4mod2.so: %s\n", dlerror ()); |
26 | exit (status: 1); |
27 | } |
28 | if (dlclose (handle: h1) != 0) |
29 | { |
30 | printf (format: "closing h1 failed: %s\n", dlerror ()); |
31 | exit (status: 1); |
32 | } |
33 | if (dlclose (handle: h2) != 0) |
34 | { |
35 | printf (format: "closing h2 failed: %s\n", dlerror ()); |
36 | exit (status: 1); |
37 | } |
38 | } |
39 | return 0; |
40 | } |
41 |