source: vendor/glibc-tests/2005-06-14/elf/tst-pathopt.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: 634 bytes
Line 
1#include <dlfcn.h>
2#include <mcheck.h>
3#include <stdio.h>
4#include <stdlib.h>
5
6
7int
8main (void)
9{
10 void *h;
11 int (*fp) (int);
12 int result;
13
14 mtrace ();
15
16 h = dlopen ("renamed.so", RTLD_LAZY);
17 if (h == NULL)
18 {
19 printf ("failed to load \"%s\": %s\n", "renamed.so", dlerror ());
20 exit (1);
21 }
22
23 fp = dlsym (h, "in_renamed");
24 if (fp == NULL)
25 {
26 printf ("lookup of \"%s\" failed: %s\n", "in_renamed", dlerror ());
27 exit (1);
28 }
29
30 result = fp (10);
31
32 if (dlclose (h) != 0)
33 {
34 printf ("failed to close \"%s\": %s\n", "renamed.so", dlerror ());
35 exit (1);
36 }
37
38 return result;
39}
Note: See TracBrowser for help on using the repository browser.