From 3fe400152688be6f4fea1f9dd07e8d8fe5be4e46 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Sat, 16 Sep 2000 09:08:30 +0000 Subject: Update. 2000-09-16 Ulrich Drepper * dlfcn/Makefile (distribute): Add defaultmod1.c and defaultmod2.c. (test): Add default. (modules-names): Add defaultmod1 and defaultmod2. Add rules to build test objects. --- dlfcn/defaultmod1.c | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 dlfcn/defaultmod1.c (limited to 'dlfcn/defaultmod1.c') diff --git a/dlfcn/defaultmod1.c b/dlfcn/defaultmod1.c new file mode 100644 index 0000000000..2c26e389bc --- /dev/null +++ b/dlfcn/defaultmod1.c @@ -0,0 +1,62 @@ +#include +#include + +int +found_in_mod1 (void) +{ + return 1; +} + + +int +test_in_mod1 (void *mainp) +{ + int (*ifp) (void); + void *p; + int result = 0; + + /* Find function `main'. */ + p = dlsym (RTLD_DEFAULT, "main"); + if (p == NULL) + { + printf ("%s: main not found\n", __FILE__); + result = 1; + } + else if (p != mainp) + { + printf ("%s: wrong address returned for main\n", __FILE__); + result = 1; + } + else + printf ("%s: main correctly found\n", __FILE__); + + ifp = dlsym (RTLD_DEFAULT, "found_in_mod1"); + if ((void *) ifp == NULL) + { + printf ("%s: found_in_mod1 not found\n", __FILE__); + result = 1; + } + else if (ifp () != 1) + { + printf ("%s: wrong address returned for found_in_mod1\n", __FILE__); + result = 1; + } + else + printf ("%s: found_in_mod1 correctly found\n", __FILE__); + + ifp = dlsym (RTLD_DEFAULT, "found_in_mod2"); + if ((void *) ifp == NULL) + { + printf ("%s: found_in_mod2 not found\n", __FILE__); + result = 1; + } + else if (ifp () != 2) + { + printf ("%s: wrong address returned for found_in_mod2\n", __FILE__); + result = 1; + } + else + printf ("%s: found_in_mod2 correctly found\n", __FILE__); + + return result; +} -- cgit 1.4.1