Add more NEWS items for 2.17.
[glibc.git] / elf / origtest.c
blob1cacabcc39e9f1b51e52a3f38a974e8f56dc23d3
1 #include <dlfcn.h>
2 #include <error.h>
3 #include <stdio.h>
4 #include <stdlib.h>
6 int
7 main (void)
9 void *h;
10 int (*fp) (int);
11 int res;
13 h = dlopen ("${ORIGIN}/testobj1.so", RTLD_LAZY);
14 if (h == NULL)
15 error (EXIT_FAILURE, 0, "while loading `%s': %s", "testobj1.so",
16 dlerror ());
18 fp = dlsym (h, "obj1func1");
19 if (fp == NULL)
20 error (EXIT_FAILURE, 0, "getting `obj1func1' in `%s': %s",
21 "testobj1.so", dlerror ());
23 res = fp (10);
24 printf ("fp(10) = %d\n", res);
26 if (dlclose (h) != 0)
27 error (EXIT_FAILURE, 0, "while close `%s': %s",
28 "testobj1.so", dlerror ());
30 return res != 42;
34 extern int foo (int a);
35 int
36 foo (int a)
38 return a + 10;