diff options
Diffstat (limited to 'libc/elf/reldepmod3.c')
-rw-r--r-- | libc/elf/reldepmod3.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/libc/elf/reldepmod3.c b/libc/elf/reldepmod3.c new file mode 100644 index 000000000..66a996cd9 --- /dev/null +++ b/libc/elf/reldepmod3.c @@ -0,0 +1,20 @@ +#include <dlfcn.h> +#include <stdio.h> +#include <stdlib.h> + +extern int call_me (void); + +int +call_me (void) +{ + int (*fp) (void); + + fp = dlsym (RTLD_DEFAULT, "foo"); + if (fp == NULL) + { + printf ("cannot get address of foo in global scope: %s\n", dlerror ()); + exit (1); + } + + return fp () - 42; +} |