source: branches/libc-0.6/src/libctests/glibc/dlfcn/bug-dlsym1.c

Last change on this file was 2036, checked in by bird, 20 years ago

Initial revision

  • Property cvs2svn:cvs-rev set to 1.1
  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 664 bytes
Line 
1/* Test case for bug in dlsym accessing dependency objects' symbols. */
2
3#include <stdlib.h>
4#include <stdio.h>
5#include <unistd.h>
6#include <dlfcn.h>
7
8int main(void)
9{
10 void *handle;
11 char *c;
12
13 /* open lib1.so, which has the unresolved test symbol and a DT_NEEDED
14 on lib2.so, which provides the symbol */
15 if ((handle = dlopen("bug-dlsym1-lib1.so", RTLD_NOW)) == NULL) {
16 printf("dlopen(\"bug-dlsym1-lib1.so\"): %s\n", dlerror());
17 abort();
18 }
19
20 if ((c = dlsym(handle, "dlopen_test_variable")) == NULL) {
21 printf("dlsym(handle, \"dlopen_test_variable\"): %s\n", dlerror());
22 abort();
23 }
24
25 (void) dlclose(handle);
26
27 return 0;
28}
Note: See TracBrowser for help on using the repository browser.