]> git.ipfire.org Git - thirdparty/glibc.git/blame - dlfcn/defaultmod2.c
szl_PL locale: Spelling corrections (bug 24652).
[thirdparty/glibc.git] / dlfcn / defaultmod2.c
CommitLineData
3fe40015
UD
1#include <dlfcn.h>
2#include <stdio.h>
3
20bb2883 4extern int found_in_mod1 (void);
3fe40015
UD
5int
6found_in_mod1 (void)
7{
8 return 1;
9}
10
20bb2883 11extern int found_in_mod2 (void);
3fe40015
UD
12int
13found_in_mod2 (void)
14{
15 return 2;
16}
17
18
d57a3f0e 19extern int test_in_mod2 (int (*mainp)(int, char **));
3fe40015 20int
d57a3f0e 21test_in_mod2 (int (*mainp)(int, char **))
3fe40015
UD
22{
23 int (*ifp) (void);
24 void *p;
25 int result = 0;
26
27 /* Find function `main'. */
28 p = dlsym (RTLD_DEFAULT, "main");
29 if (p == NULL)
30 {
31 printf ("%s: main not found\n", __FILE__);
32 result = 1;
33 }
d57a3f0e 34 else if ((int (*)(int, char **))p != mainp)
3fe40015
UD
35 {
36 printf ("%s: wrong address returned for main\n", __FILE__);
37 result = 1;
38 }
39 else
40 printf ("%s: main correctly found\n", __FILE__);
41
42 ifp = dlsym (RTLD_DEFAULT, "found_in_mod1");
43 if ((void *) ifp == NULL)
44 {
45 printf ("%s: found_in_mod1 not found\n", __FILE__);
46 result = 1;
47 }
48 else if (ifp () != 1)
49 {
50 printf ("%s: wrong address returned for found_in_mod1\n", __FILE__);
51 result = 1;
52 }
53 else
54 printf ("%s: found_in_mod1 correctly found\n", __FILE__);
55
56 ifp = dlsym (RTLD_DEFAULT, "found_in_mod2");
57 if ((void *) ifp == NULL)
58 {
59 printf ("%s: found_in_mod2 not found\n", __FILE__);
60 result = 1;
61 }
62 else if (ifp () != 2)
63 {
64 printf ("%s: wrong address returned for found_in_mod2\n", __FILE__);
65 result = 1;
66 }
67 else
68 printf ("%s: found_in_mod2 correctly found\n", __FILE__);
69
70 return result;
71}