* posix/execl.c: Fix last argument of memcpy. Reported by Brian
[glibc.git] / dlfcn / defaultmod2.c
blobc8615e2dc3d34a00384d16a05d07f72da3ce4f4e
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;
11 extern int found_in_mod2 (void);
12 int
13 found_in_mod2 (void)
15 return 2;
19 extern int test_in_mod2 (void *mainp);
20 int
21 test_in_mod2 (void *mainp)
23 int (*ifp) (void);
24 void *p;
25 int result = 0;
27 /* Find function `main'. */
28 p = dlsym (RTLD_DEFAULT, "main");
29 if (p == NULL)
31 printf ("%s: main not found\n", __FILE__);
32 result = 1;
34 else if (p != mainp)
36 printf ("%s: wrong address returned for main\n", __FILE__);
37 result = 1;
39 else
40 printf ("%s: main correctly found\n", __FILE__);
42 ifp = dlsym (RTLD_DEFAULT, "found_in_mod1");
43 if ((void *) ifp == NULL)
45 printf ("%s: found_in_mod1 not found\n", __FILE__);
46 result = 1;
48 else if (ifp () != 1)
50 printf ("%s: wrong address returned for found_in_mod1\n", __FILE__);
51 result = 1;
53 else
54 printf ("%s: found_in_mod1 correctly found\n", __FILE__);
56 ifp = dlsym (RTLD_DEFAULT, "found_in_mod2");
57 if ((void *) ifp == NULL)
59 printf ("%s: found_in_mod2 not found\n", __FILE__);
60 result = 1;
62 else if (ifp () != 2)
64 printf ("%s: wrong address returned for found_in_mod2\n", __FILE__);
65 result = 1;
67 else
68 printf ("%s: found_in_mod2 correctly found\n", __FILE__);
70 return result;