1 #include <dlfcn.h> 2 #include <stdio.h> 3 #include <stdlib.h> 4 5 void mod3_fini2(void)6mod3_fini2 (void) 7 { 8 } 9 10 void mod3_fini(void)11mod3_fini (void) 12 { 13 mod3_fini2 (); 14 } 15 16 void mod3(void)17mod3 (void) 18 { 19 void *h = dlopen ("$ORIGIN/unload8mod2.so", RTLD_LAZY); 20 if (h == NULL) 21 { 22 puts ("dlopen unload8mod2.so failed"); 23 exit (1); 24 } 25 26 atexit (mod3_fini); 27 } 28