diff options
author | Ulrich Drepper <drepper@redhat.com> | 2002-04-15 17:10:22 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2002-04-15 17:10:22 +0000 |
commit | a41d8a74ee92f66068ff1323b6de3e703306bfe2 (patch) | |
tree | 680a2abaadedcdde8afcdac7f0688866665011f5 /elf/reldep7.c | |
parent | 78575a842bce4d8e8c725506da1f826d16b660eb (diff) | |
download | glibc-a41d8a74ee92f66068ff1323b6de3e703306bfe2.tar.gz glibc-a41d8a74ee92f66068ff1323b6de3e703306bfe2.tar.xz glibc-a41d8a74ee92f66068ff1323b6de3e703306bfe2.zip |
Update.
2002-02-17 Andreas Schwab <schwab@suse.de> * reldep7.c: New file. * reldep7mod1.c: New file. * reldep7mod2.c: New file. * Makefile: Add rules to build and run reldep7.
Diffstat (limited to 'elf/reldep7.c')
-rw-r--r-- | elf/reldep7.c | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/elf/reldep7.c b/elf/reldep7.c new file mode 100644 index 0000000000..5275a0e8f1 --- /dev/null +++ b/elf/reldep7.c @@ -0,0 +1,58 @@ +#include <dlfcn.h> +#include <stdio.h> +#include <stdlib.h> + +int +main (void) +{ + void *h1; + void *h2; + void *mod1_bar, *mod2_bar; + + h1 = dlopen ("reldep7mod1.so", RTLD_GLOBAL | RTLD_LAZY); + if (h1 == NULL) + { + printf ("cannot open reldep7mod1.so: %s\n", dlerror ()); + exit (1); + } + + h2 = dlopen ("reldep7mod2.so", RTLD_GLOBAL | RTLD_LAZY); + if (h2 == NULL) + { + printf ("cannot open reldep7mod1.so: %s\n", dlerror ()); + exit (1); + } + + mod1_bar = dlsym (h1, "mod1_bar"); + if (mod1_bar == NULL) + { + printf ("cannot get address of \"mod1_bar\": %s\n", dlerror ()); + exit (1); + } + + mod2_bar = dlsym (h2, "mod2_bar"); + if (mod2_bar == NULL) + { + printf ("cannot get address of \"mod2_bar\": %s\n", dlerror ()); + exit (1); + } + + printf ("%d\n", ((int (*) (void)) mod1_bar) ()); + printf ("%d\n", ((int (*) (void)) mod2_bar) ()); + + if (dlclose (h1) != 0) + { + printf ("closing h1 failed: %s\n", dlerror ()); + exit (1); + } + + printf ("%d\n", ((int (*) (void)) mod2_bar) ()); + + if (dlclose (h2) != 0) + { + printf ("closing h2 failed: %s\n", dlerror ()); + exit (1); + } + + return 0; +} |