10 for (map = _r_debug.r_map; map != NULL; map = map->l_next) \
11 if (map->l_type == lt_loaded) \
12 printf ("name = \"%s\", direct_opencount = %d\n", \
13 map->l_name, (int) map->l_direct_opencount); \
23 h
[0] = dlopen ("unload2mod.so", RTLD_LAZY
);
24 h
[1] = dlopen ("unload2mod.so", RTLD_LAZY
);
25 if (h
[0] == NULL
|| h
[1] == NULL
)
26 error (EXIT_FAILURE
, errno
, "cannot load \"unload2mod.so\"");
27 h
[2] = dlopen ("unload2dep.so", RTLD_LAZY
);
29 error (EXIT_FAILURE
, errno
, "cannot load \"unload2dep.so\"");
31 puts ("\nAfter loading everything:");
36 puts ("\nAfter unloading \"unload2mod.so\" once:");
41 puts ("\nAfter unloading \"unload2mod.so\" twice:");
44 fp
= dlsym (h
[2], "foo");
45 puts ("\nnow calling `foo'");
48 puts ("managed to call `foo'");
53 puts ("\nAfter unloading \"unload2dep.so\":");