Update.
[glibc.git] / dlfcn / defaultmod1.c
blob2c26e389bc9b94f2402d04c602b1efd4ef3cbfcd
1 #include <dlfcn.h>
2 #include <stdio.h>
4 int
5 found_in_mod1 (void)
7 return 1;
11 int
12 test_in_mod1 (void *mainp)
14 int (*ifp) (void);
15 void *p;
16 int result = 0;
18 /* Find function `main'. */
19 p = dlsym (RTLD_DEFAULT, "main");
20 if (p == NULL)
22 printf ("%s: main not found\n", __FILE__);
23 result = 1;
25 else if (p != mainp)
27 printf ("%s: wrong address returned for main\n", __FILE__);
28 result = 1;
30 else
31 printf ("%s: main correctly found\n", __FILE__);
33 ifp = dlsym (RTLD_DEFAULT, "found_in_mod1");
34 if ((void *) ifp == NULL)
36 printf ("%s: found_in_mod1 not found\n", __FILE__);
37 result = 1;
39 else if (ifp () != 1)
41 printf ("%s: wrong address returned for found_in_mod1\n", __FILE__);
42 result = 1;
44 else
45 printf ("%s: found_in_mod1 correctly found\n", __FILE__);
47 ifp = dlsym (RTLD_DEFAULT, "found_in_mod2");
48 if ((void *) ifp == NULL)
50 printf ("%s: found_in_mod2 not found\n", __FILE__);
51 result = 1;
53 else if (ifp () != 2)
55 printf ("%s: wrong address returned for found_in_mod2\n", __FILE__);
56 result = 1;
58 else
59 printf ("%s: found_in_mod2 correctly found\n", __FILE__);
61 return result;