Modulefor test of error handling in dynamic loading interface.
authordrepper <drepper>
Sat, 10 Jun 2000 04:29:34 +0000 (04:29 +0000)
committerdrepper <drepper>
Sat, 10 Jun 2000 04:29:34 +0000 (04:29 +0000)
dlfcn/failtestmod.c [new file with mode: 0644]

diff --git a/dlfcn/failtestmod.c b/dlfcn/failtestmod.c
new file mode 100644 (file)
index 0000000..595da4d
--- /dev/null
@@ -0,0 +1,25 @@
+#include <dlfcn.h>
+#include <stdio.h>
+
+
+void
+__attribute__ ((__constructor__))
+constr (void)
+{
+  void *handle;
+  void *m;
+
+  /* Open the library.  */
+  handle = dlopen (NULL, RTLD_NOW);
+  if (handle == NULL)
+    {
+      puts ("Cannot get handle to own object");
+      return;
+    }
+
+  /* Get a symbol.  */
+  m = dlsym (handle, "main");
+  puts ("called dlsym() to get main");
+
+  dlclose (handle);
+}