Back to index

glibc  2.9
reldepmod3.c
Go to the documentation of this file.
00001 #include <dlfcn.h>
00002 #include <stdio.h>
00003 #include <stdlib.h>
00004 
00005 extern int call_me (void);
00006 
00007 int
00008 call_me (void)
00009 {
00010   int (*fp) (void);
00011 
00012   fp = dlsym (RTLD_DEFAULT, "foo");
00013   if (fp == NULL)
00014     {
00015       printf ("cannot get address of foo in global scope: %s\n", dlerror ());
00016       exit (1);
00017     }
00018 
00019   return fp () - 42;
00020 }