about summary refs log tree commit diff
path: root/elf/dblload.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2001-09-06 01:03:05 +0000
committerUlrich Drepper <drepper@redhat.com>2001-09-06 01:03:05 +0000
commit3fac0001581df9237b58c0180bc7f968dfabc3c9 (patch)
tree477072929cbd57e0bd095b41de533ea903a1ae4e /elf/dblload.c
parent9cd9ea1068e85dc5a211543b5ba4637ffc6df8be (diff)
downloadglibc-3fac0001581df9237b58c0180bc7f968dfabc3c9.tar.gz
glibc-3fac0001581df9237b58c0180bc7f968dfabc3c9.tar.xz
glibc-3fac0001581df9237b58c0180bc7f968dfabc3c9.zip
Update.
2001-09-05  Ulrich Drepper  <drepper@redhat.com>

	* elf/Makefile: Add rules to build new tests.  Don't run them yet since
	they both fail.
	* elf/dblload.c: New file.
	* elf/dblloadmod1.c: New file.
	* elf/dblloadmod2.c: New file.
	* elf/dblloadmod3.c: New file.
	* elf/dblunload.c: New file.
Diffstat (limited to 'elf/dblload.c')
-rw-r--r--elf/dblload.c53
1 files changed, 53 insertions, 0 deletions
diff --git a/elf/dblload.c b/elf/dblload.c
new file mode 100644
index 0000000000..52389a60ce
--- /dev/null
+++ b/elf/dblload.c
@@ -0,0 +1,53 @@
+#include <dlfcn.h>
+#include <mcheck.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+
+int
+main (void)
+{
+  void *p1;
+  void *p2;
+  int (*fp) (void);
+  int result;
+
+  mtrace ();
+
+  p1 = dlopen ("dblloadmod1.so", RTLD_LAZY);
+  if (p1 == NULL)
+    {
+      printf ("cannot open dblloadmod1.so: %s\n", dlerror ());
+      exit (EXIT_FAILURE);
+    }
+
+  p2 = dlopen ("dblloadmod2.so", RTLD_LAZY);
+  if (p1 == NULL)
+    {
+      printf ("cannot open dblloadmod2.so: %s\n", dlerror ());
+      exit (EXIT_FAILURE);
+    }
+
+  fp = dlsym (p1, "foo");
+  if (fp == NULL)
+    {
+      printf ("cannot get function \"foo\": %s\n", dlerror ());
+      exit (EXIT_FAILURE);
+    }
+
+  result = fp ();
+
+  if (dlclose (p1) != 0)
+    {
+      printf ("error while closing dblloadmod1.so: %s\n", dlerror ());
+      exit (EXIT_FAILURE);
+    }
+
+  if (dlclose (p2) != 0)
+    {
+      printf ("error while closing dblloadmod2.so: %s\n", dlerror ());
+      exit (EXIT_FAILURE);
+    }
+
+  return result;
+}