5 /* Simple program to see if dlopen() would succeed. */
6 int main(int argc
, char **argv
)
11 for (i
= 1; i
< argc
; i
++) {
12 if (dlopen(argv
[i
], RTLD_NOW
)) {
13 fprintf(stdout
, "dlopen() of \"%s\" succeeded.\n",
16 snprintf(buf
, sizeof(buf
), "./%s", argv
[i
]);
17 if ((stat(buf
, &st
) == 0) && dlopen(buf
, RTLD_NOW
)) {
18 fprintf(stdout
, "dlopen() of \"./%s\" "
19 "succeeded.\n", argv
[i
]);
21 fprintf(stdout
, "dlopen() of \"%s\" failed: "
22 "%s\n", argv
[i
], dlerror());