6 extern int test_in_mod1 (void *);
7 extern int test_in_mod2 (void *);
11 main (int argc, char *argv[])
19 if (info.dli_fname == NULL)
21 printf ("%s: dladdr returns NULL dli_fname\n", __FILE__);
24 else if (strcmp (info.dli_fname, argv[0]))
26 printf ("%s: dladdr returned '%s' as dli_fname\n", __FILE__, info.dli_fname);
30 printf ("%s: dladdr returned correct dli_fname\n", __FILE__);
32 /* Find function `main'. */
33 p = dlsym (RTLD_DEFAULT, "main");
36 printf ("%s: main not found\n", __FILE__);
39 else if ((int (*)(int, char **))p != main)
41 printf ("%s: wrong address returned for main\n", __FILE__);
45 printf ("%s: main correctly found\n", __FILE__);
47 ifp = dlsym (RTLD_DEFAULT, "found_in_mod1");
48 if ((void *) ifp == NULL)
50 printf ("%s: found_in_mod1 not found\n", __FILE__);
55 printf ("%s: wrong address returned for found_in_mod1\n", __FILE__);
59 printf ("%s: found_in_mod1 correctly found\n", __FILE__);
61 ifp = dlsym (RTLD_DEFAULT, "found_in_mod2");
62 if ((void *) ifp == NULL)
64 printf ("%s: found_in_mod2 not found\n", __FILE__);
69 printf ("%s: wrong address returned for found_in_mod2\n", __FILE__);
73 printf ("%s: found_in_mod2 correctly found\n", __FILE__);
75 result |= test_in_mod1 (main);
77 result |= test_in_mod2 (main);