diff options
Diffstat (limited to 'testsuite/tests/dynlibs/T3807-load.c')
-rw-r--r-- | testsuite/tests/dynlibs/T3807-load.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/testsuite/tests/dynlibs/T3807-load.c b/testsuite/tests/dynlibs/T3807-load.c new file mode 100644 index 0000000000..8c6f252c5f --- /dev/null +++ b/testsuite/tests/dynlibs/T3807-load.c @@ -0,0 +1,39 @@ +#include <dlfcn.h> +#include <stdio.h> + +int main(void) { + int i; + void *dh; + void (*test_init)(void); + int (*test_foo)(void); + void (*test_exit)(void); + + dh = dlopen("./T3807test.so", RTLD_NOW | RTLD_GLOBAL); + if (!dh) { + printf("Failed to open shared library: %s\n", dlerror()); + return 1; + } + + test_init = dlsym(dh, "test_init"); + if (!test_init) { + printf("Failed to find test_init: %s", dlerror()); + return 1; + } + test_foo = dlsym(dh, "foo"); + if (!test_foo) { + printf("Failed to find test_foo: %s", dlerror()); + return 1; + } + test_exit = dlsym(dh, "test_exit"); + if (!test_exit) { + printf("Failed to find test_exit: %s", dlerror()); + return 1; + } + + test_init(); + i = test_foo(); + printf("i is %d\n", i); + test_exit(); + + return 0; +} |