Warning: That file was not part of the compilation database. It may have many parsing errors.

1#include <dlfcn.h>
2#include <stdio.h>
3
4extern int found_in_mod1 (void);
5int
6found_in_mod1 (void)
7{
8 return 1;
9}
10
11extern int found_in_mod2 (void);
12int
13found_in_mod2 (void)
14{
15 return 2;
16}
17
18
19extern int test_in_mod2 (int (*mainp)(int, char **));
20int
21test_in_mod2 (int (*mainp)(int, char **))
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 }
34 else if ((int (*)(int, char **))p != mainp)
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}
72

Warning: That file was not part of the compilation database. It may have many parsing errors.