(sem_timedwait): Fix a typo.
[glibc/pb-stable.git] / dlfcn / defaultmod1.c
blob9f330b7f2959d7806b0f6c571374d598d88b233c
1 #include <dlfcn.h>
2 #include <stdio.h>
4 extern int found_in_mod1 (void);
5 int
6 found_in_mod1 (void)
8 return 1;
12 extern int test_in_mod1 (void *mainp);
13 int
14 test_in_mod1 (void *mainp)
16 int (*ifp) (void);
17 void *p;
18 int result = 0;
20 /* Find function `main'. */
21 p = dlsym (RTLD_DEFAULT, "main");
22 if (p == NULL)
24 printf ("%s: main not found\n", __FILE__);
25 result = 1;
27 else if (p != mainp)
29 printf ("%s: wrong address returned for main\n", __FILE__);
30 result = 1;
32 else
33 printf ("%s: main correctly found\n", __FILE__);
35 ifp = dlsym (RTLD_DEFAULT, "found_in_mod1");
36 if ((void *) ifp == NULL)
38 printf ("%s: found_in_mod1 not found\n", __FILE__);
39 result = 1;
41 else if (ifp () != 1)
43 printf ("%s: wrong address returned for found_in_mod1\n", __FILE__);
44 result = 1;
46 else
47 printf ("%s: found_in_mod1 correctly found\n", __FILE__);
49 ifp = dlsym (RTLD_DEFAULT, "found_in_mod2");
50 if ((void *) ifp == NULL)
52 printf ("%s: found_in_mod2 not found\n", __FILE__);
53 result = 1;
55 else if (ifp () != 2)
57 printf ("%s: wrong address returned for found_in_mod2\n", __FILE__);
58 result = 1;
60 else
61 printf ("%s: found_in_mod2 correctly found\n", __FILE__);
63 return result;