9 #define MAPS ((struct link_map *) _r_debug.r_map)
12 for (map = MAPS; map != NULL; map = map->l_next) \
13 if (map->l_type == lt_loaded) \
14 printf ("name = \"%s\", direct_opencount = %d\n", \
15 map->l_name, (int) map->l_direct_opencount); \
25 h
[0] = dlopen ("unload2mod.so", RTLD_LAZY
);
26 h
[1] = dlopen ("unload2mod.so", RTLD_LAZY
);
27 if (h
[0] == NULL
|| h
[1] == NULL
)
28 error (EXIT_FAILURE
, errno
, "cannot load \"unload2mod.so\"");
29 h
[2] = dlopen ("unload2dep.so", RTLD_LAZY
);
31 error (EXIT_FAILURE
, errno
, "cannot load \"unload2dep.so\"");
33 puts ("\nAfter loading everything:");
38 puts ("\nAfter unloading \"unload2mod.so\" once:");
43 puts ("\nAfter unloading \"unload2mod.so\" twice:");
46 fp
= dlsym (h
[2], "foo");
47 puts ("\nnow calling `foo'");
50 puts ("managed to call `foo'");
55 puts ("\nAfter unloading \"unload2dep.so\":");