about summary refs log tree commit diff
path: root/dlfcn/failtestmod.c
diff options
context:
space:
mode:
Diffstat (limited to 'dlfcn/failtestmod.c')
-rw-r--r--dlfcn/failtestmod.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/dlfcn/failtestmod.c b/dlfcn/failtestmod.c
new file mode 100644
index 0000000000..595da4d567
--- /dev/null
+++ b/dlfcn/failtestmod.c
@@ -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);
+}