Updated to fedora-glibc-20070801T1703
[glibc.git] / elf / dblload.c
blob52389a60ce6cfe102aad6fdc5aed047f6a6adf5e
1 #include <dlfcn.h>
2 #include <mcheck.h>
3 #include <stdio.h>
4 #include <stdlib.h>
7 int
8 main (void)
10 void *p1;
11 void *p2;
12 int (*fp) (void);
13 int result;
15 mtrace ();
17 p1 = dlopen ("dblloadmod1.so", RTLD_LAZY);
18 if (p1 == NULL)
20 printf ("cannot open dblloadmod1.so: %s\n", dlerror ());
21 exit (EXIT_FAILURE);
24 p2 = dlopen ("dblloadmod2.so", RTLD_LAZY);
25 if (p1 == NULL)
27 printf ("cannot open dblloadmod2.so: %s\n", dlerror ());
28 exit (EXIT_FAILURE);
31 fp = dlsym (p1, "foo");
32 if (fp == NULL)
34 printf ("cannot get function \"foo\": %s\n", dlerror ());
35 exit (EXIT_FAILURE);
38 result = fp ();
40 if (dlclose (p1) != 0)
42 printf ("error while closing dblloadmod1.so: %s\n", dlerror ());
43 exit (EXIT_FAILURE);
46 if (dlclose (p2) != 0)
48 printf ("error while closing dblloadmod2.so: %s\n", dlerror ());
49 exit (EXIT_FAILURE);
52 return result;