summaryrefslogtreecommitdiff
path: root/test/dlopen/libC.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/dlopen/libC.c')
-rw-r--r--test/dlopen/libC.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/dlopen/libC.c b/test/dlopen/libC.c
new file mode 100644
index 000000000..84cbbef3d
--- /dev/null
+++ b/test/dlopen/libC.c
@@ -0,0 +1,30 @@
+#include <dlfcn.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#define LIBNAME "libB.so"
+void _libC_fini(void);
+void _libC_fini(void)
+{
+ printf("libC_fini():finish - atexit()\n");
+}
+
+void libC_fini(void);
+void libC_fini(void)
+{
+ _libC_fini();
+}
+
+void libC_func(void);
+void libC_func(void)
+{
+ void *libB;
+
+ libB = dlopen(LIBNAME, RTLD_LAZY);
+ if (!libB) {
+ fprintf(stderr, "Could not open ./%s: %s\n", LIBNAME, dlerror());
+ exit(1);
+ }
+
+ atexit(libC_fini);
+}