]>
Commit | Line | Data |
---|---|---|
ff5fad16 | 1 | #include <dlfcn.h> |
249fd241 | 2 | #include <stdio.h> |
ff5fad16 UD |
3 | |
4 | static const char obj[] = "testobj1.so"; | |
5 | ||
6 | int | |
7 | main (void) | |
8 | { | |
9 | void *d = dlopen (obj, RTLD_LAZY); | |
10 | int n; | |
11 | ||
12 | if (d == NULL) | |
13 | { | |
14 | printf ("cannot load %s: %s\n", obj, dlerror ()); | |
15 | return 1; | |
16 | } | |
17 | ||
18 | for (n = 0; n < 10000; ++n) | |
19 | if (dlsym (d, "does not exist") != NULL) | |
20 | { | |
21 | puts ("dlsym() did not fail"); | |
22 | return 1; | |
23 | } | |
249fd241 UD |
24 | else if (dlerror () == NULL) |
25 | { | |
26 | puts ("dlerror() didn't return a string"); | |
27 | return 1; | |
28 | } | |
ff5fad16 UD |
29 | |
30 | return 0; | |
31 | } |