From 536362633fc9b7615f3cd2c0543e553c3e0f4cdf Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Fri, 27 Jun 2003 11:55:20 +0000 Subject: Add a test which shows off the broken spots in our dlopen implementation --- test/dlopen/test1.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 test/dlopen/test1.c (limited to 'test/dlopen/test1.c') diff --git a/test/dlopen/test1.c b/test/dlopen/test1.c new file mode 100644 index 000000000..c13eb3006 --- /dev/null +++ b/test/dlopen/test1.c @@ -0,0 +1,33 @@ +#include +#include +#include +#include + +#ifdef __UCLIBC__ +extern void _dlinfo(void); +#endif + +int main(int argc, char **argv) { + void *handle; + int (*mydltest)(const char *s); + char *error; + + handle = dlopen ("./libtest1.so", RTLD_LAZY); + if (!handle) { + fprintf(stderr, "Could not open ./libtest1.so: %s\n", dlerror()); + exit(1); + } + + mydltest = dlsym(handle, "dltest"); + if ((error = dlerror()) != NULL) { + fprintf(stderr, "Could not locate symbol 'dltest': %s\n", error); + exit(1); + } + + mydltest("hello world!"); + + dlclose(handle); + + return EXIT_SUCCESS; +} + -- cgit v1.2.3