10 void *mod1_bar
, *mod2_bar
;
12 h1
= dlopen ("reldep7mod1.so", RTLD_GLOBAL
| RTLD_LAZY
);
15 printf ("cannot open reldep7mod1.so: %s\n", dlerror ());
19 h2
= dlopen ("reldep7mod2.so", RTLD_GLOBAL
| RTLD_LAZY
);
22 printf ("cannot open reldep7mod1.so: %s\n", dlerror ());
26 mod1_bar
= dlsym (h1
, "mod1_bar");
29 printf ("cannot get address of \"mod1_bar\": %s\n", dlerror ());
33 mod2_bar
= dlsym (h2
, "mod2_bar");
36 printf ("cannot get address of \"mod2_bar\": %s\n", dlerror ());
40 printf ("%d\n", ((int (*) (void)) mod1_bar
) ());
41 printf ("%d\n", ((int (*) (void)) mod2_bar
) ());
43 if (dlclose (h1
) != 0)
45 printf ("closing h1 failed: %s\n", dlerror ());
49 printf ("%d\n", ((int (*) (void)) mod2_bar
) ());
51 if (dlclose (h2
) != 0)
53 printf ("closing h2 failed: %s\n", dlerror ());