]>
Commit | Line | Data |
---|---|---|
19cf43be UD |
1 | #include <dlfcn.h> |
2 | #include <errno.h> | |
3 | #include <error.h> | |
805d2e7d | 4 | #include <mcheck.h> |
ae24ce1f | 5 | #include <stdio.h> |
19cf43be UD |
6 | #include <stdlib.h> |
7 | ||
8 | int | |
9 | main (void) | |
10 | { | |
11 | int (*foo) (void); | |
12 | void *h; | |
13 | int ret; | |
14 | ||
805d2e7d UD |
15 | mtrace (); |
16 | ||
19cf43be UD |
17 | h = dlopen ("constload2.so", RTLD_LAZY | RTLD_GLOBAL); |
18 | if (h == NULL) | |
19 | error (EXIT_FAILURE, errno, "cannot load module \"constload2.so\""); | |
20 | foo = dlsym (h, "foo"); | |
21 | ret = foo (); | |
752a2a50 UD |
22 | /* Note that the following dlclose() call cannot unload the objects. |
23 | Due to the introduced relocation dependency constload2.so depends | |
24 | on constload3.so and the dependencies of constload2.so on constload3.so | |
25 | is not visible to ld.so since it's done using dlopen(). */ | |
805d2e7d UD |
26 | if (dlclose (h) != 0) |
27 | { | |
28 | puts ("failed to close"); | |
29 | exit (EXIT_FAILURE); | |
30 | } | |
19cf43be UD |
31 | return ret; |
32 | } |