Update.
[glibc.git] / elf / restest1.c
blobe4eca557c5e523129dfc33af4f2b60147228e1e8
1 #include <dlfcn.h>
2 #include <error.h>
3 #include <stdio.h>
4 #include <stdlib.h>
6 int
7 main (void)
9 void *h1;
10 int (*fp1) (int);
11 void *h2;
12 int (*fp2) (int);
13 int res1;
14 int res2;
16 h1 = dlopen ("testobj1.so", RTLD_LAZY);
17 if (h1 == NULL)
18 error (EXIT_FAILURE, 0, "while loading `%s': %s", "testobj1.so",
19 dlerror ());
21 h2 = dlopen ("testobj1_1.so", RTLD_LAZY);
22 if (h1 == NULL)
23 error (EXIT_FAILURE, 0, "while loading `%s': %s", "testobj1_1.so",
24 dlerror ());
26 fp1 = dlsym (h1, "obj1func1");
27 if (fp1 == NULL)
28 error (EXIT_FAILURE, 0, "getting `obj1func1' in `%s': %s",
29 "testobj1.so", dlerror ());
31 fp2 = dlsym (h2, "obj1func1");
32 if (fp2 == NULL)
33 error (EXIT_FAILURE, 0, "getting `obj1func1' in `%s': %s",
34 "testobj1_1.so", dlerror ());
36 res1 = fp1 (10);
37 res2 = fp2 (10);
38 printf ("fp1(10) = %d\nfp2(10) = %d\n", res1, res2);
40 return res1 != 42 || res2 != 72;
44 int
45 foo (int a)
47 return a + 10;