2003-05-28 Roland McGrath <roland@redhat.com>
[glibc.git] / dlfcn / bug-dlsym1.c
blob61c6cda5608ad75312c12acba089b6434ffb7f5e
1 /* Test case for bug in dlsym accessing dependency objects' symbols. */
3 #include <stdlib.h>
4 #include <stdio.h>
5 #include <unistd.h>
6 #include <dlfcn.h>
8 int main(void)
10 void *handle;
11 char *c;
13 setenv ("LD_LIBRARY_PATH", "/home/roland/build/tls-libc/dlfcn", 1);
15 /* open lib1.so, which has the unresolved test symbol and a DT_NEEDED
16 on lib2.so, which provides the symbol */
17 if ((handle = dlopen("bug-dlsym1-lib1.so", RTLD_NOW)) == NULL) {
18 printf("dlopen(\"bug-dlsym1-lib1.so\"): %s\n", dlerror());
19 abort();
22 if ((c = dlsym(handle, "dlopen_test_variable")) == NULL) {
23 printf("dlsym(handle, \"dlopen_test_variable\"): %s\n", dlerror());
24 abort();
27 (void) dlclose(handle);
29 return 0;