1 | #include <dlfcn.h> |
---|---|
2 | #include <mcheck.h> |
3 | #include <stdio.h> |
4 | #include <stdlib.h> |
5 | |
6 | |
7 | static int |
8 | do_test (void) |
9 | { |
10 | void *h; |
11 | int (*fp) (int); |
12 | int result; |
13 | |
14 | mtrace (); |
15 | |
16 | h = dlopen (file: "renamed.so", RTLD_LAZY); |
17 | if (h == NULL) |
18 | { |
19 | printf (format: "failed to load \"%s\": %s\n", "renamed.so", dlerror ()); |
20 | exit (status: 1); |
21 | } |
22 | |
23 | fp = dlsym (handle: h, name: "in_renamed"); |
24 | if (fp == NULL) |
25 | { |
26 | printf (format: "lookup of \"%s\" failed: %s\n", "in_renamed", dlerror ()); |
27 | exit (status: 1); |
28 | } |
29 | |
30 | result = fp (10); |
31 | |
32 | if (dlclose (handle: h) != 0) |
33 | { |
34 | printf (format: "failed to close \"%s\": %s\n", "renamed.so", dlerror ()); |
35 | exit (status: 1); |
36 | } |
37 | |
38 | return result; |
39 | } |
40 | |
41 | #include <support/test-driver.c> |
42 |