Back to index

glibc  2.9
order2.c
Go to the documentation of this file.
00001 #include <dlfcn.h>
00002 #include <stdio.h>
00003 
00004 
00005 int call_puts;
00006 
00007 static int
00008 do_test (void)
00009 {
00010   call_puts = 1;
00011 
00012   void *h1 = dlopen ("$ORIGIN/order2mod1.so", RTLD_LAZY | RTLD_GLOBAL);
00013   if (h1 == NULL)
00014     {
00015       puts ("cannot load order2mod1");
00016       return 1;
00017     }
00018   void *h2 = dlopen ("$ORIGIN/order2mod2.so", RTLD_LAZY);
00019   if (h2 == NULL)
00020     {
00021       puts ("cannot load order2mod2");
00022       return 1;
00023     }
00024   if (dlclose (h1) != 0)
00025     {
00026       puts ("dlclose order2mod1 failed");
00027       return 1;
00028     }
00029   if (dlclose (h2) != 0)
00030     {
00031       puts ("dlclose order2mod2 failed");
00032       return 1;
00033     }
00034   return 0;
00035 }
00036 
00037 #define TEST_FUNCTION do_test ()
00038 #include "../test-skeleton.c"
00039 
00040 static void
00041 __attribute__ ((destructor))
00042 fini (void)
00043 {
00044   if (call_puts)
00045     puts ("5");
00046 }