Back to index

glibc  2.9
reldep4.c
Go to the documentation of this file.
00001 #include <dlfcn.h>
00002 #include <mcheck.h>
00003 #include <stdio.h>
00004 #include <stdlib.h>
00005 
00006 int
00007 main (void)
00008 {
00009   int i;
00010   void *h1, *h2;
00011 
00012   mtrace ();
00013 
00014   for (i = 0; i < 3; i++)
00015     {
00016       h1 = dlopen ("reldep4mod1.so", RTLD_NOW | RTLD_GLOBAL);
00017       if (h1 == NULL)
00018        {
00019          printf ("cannot open reldep4mod1.so: %s\n", dlerror ());
00020          exit (1);
00021        }
00022       h2 = dlopen ("reldep4mod2.so", RTLD_NOW | RTLD_GLOBAL);
00023       if (h2 == NULL)
00024        {
00025          printf ("cannot open reldep4mod2.so: %s\n", dlerror ());
00026          exit (1);
00027        }
00028       if (dlclose (h1) != 0)
00029        {
00030          printf ("closing h1 failed: %s\n", dlerror ());
00031          exit (1);
00032        }
00033       if (dlclose (h2) != 0)
00034        {
00035          printf ("closing h2 failed: %s\n", dlerror ());
00036          exit (1);
00037        }
00038     }
00039   return 0;
00040 }