Back to index

glibc  2.9
nextmod1.c
Go to the documentation of this file.
00001 #include <dlfcn.h>
00002 
00003 extern int successful_rtld_next_test (void);
00004 extern void *failing_rtld_next_use (void);
00005 
00006 int nextmod1_dummy_var;
00007 
00008 int
00009 successful_rtld_next_test (void)
00010 {
00011   int (*fp) (void);
00012 
00013   /* Get the next function... */
00014   fp = (int (*) (void)) dlsym (RTLD_NEXT, __FUNCTION__);
00015 
00016   /* ...and simply call it.  */
00017   return fp ();
00018 }
00019 
00020 
00021 void *
00022 failing_rtld_next_use (void)
00023 {
00024   void *ret = dlsym (RTLD_NEXT, __FUNCTION__);
00025 
00026   /* Ensure we are not tail call optimized, because then RTLD_NEXT
00027      might return this function.  */
00028   ++nextmod1_dummy_var;
00029   return ret;
00030 }