i386: Do not set internal_function
[glibc.git] / dlfcn / failtest.c
blobe0ac4ef63825ec89a86795417695ea21fa187b10
1 #include <dlfcn.h>
2 #include <stdio.h>
5 /* Number of rounds we perform the test. */
6 #define TEST_ROUNDS 10
9 static const char unknown[] = "a-file-with-this-name-does-not-exist";
10 static const char exists[] = "failtestmod.so";
13 int
14 main (void)
16 int i;
18 setvbuf (stdout, NULL, _IONBF, 0);
20 for (i = 0; i < TEST_ROUNDS; ++i)
22 void *dsc;
24 printf ("Round %d: Try loading \"%s\"\n", i, unknown);
26 dsc = dlopen (unknown, RTLD_NOW);
27 if (dsc != NULL)
29 printf ("We found a file of name \"%s\": this should not happen\n",
30 unknown);
31 return 1;
34 printf ("Round %d: loading \"%s\" failed\n", i, unknown);
36 /* Don't use `dlerror', just load an existing file. */
37 dsc = dlopen (exists, RTLD_NOW);
38 if (dsc == NULL)
40 printf ("Could not load \"%s\": %s\n", exists, dlerror ());
41 return 1;
44 printf ("Round %d: Loaded \"%s\"\n", i, exists);
46 dlclose (dsc);
48 printf ("Round %d: Unloaded \"%s\"\n", i, exists);
51 return 0;
55 extern void foo (void);
57 void
58 foo (void)