summaryrefslogtreecommitdiff
path: root/test/dlopen/libtest2.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/dlopen/libtest2.c')
-rw-r--r--test/dlopen/libtest2.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/test/dlopen/libtest2.c b/test/dlopen/libtest2.c
new file mode 100644
index 0000000..5261506
--- /dev/null
+++ b/test/dlopen/libtest2.c
@@ -0,0 +1,38 @@
+#include <stdio.h>
+#include <pthread.h>
+
+void __attribute__((constructor)) libtest2_ctor(void);
+void libtest2_ctor(void)
+{
+ printf("libtest2: constructor!\n");
+}
+
+void __attribute__((destructor)) libtest2_dtor(void);
+void libtest2_dtor(void)
+{
+ printf("libtest2: destructor!\n");
+}
+
+void function1(void);
+void function1(void)
+{
+ printf("libtest2: I am function1!\n");
+}
+
+void __attribute__((weak)) function2(void);
+void function2(void)
+{
+ printf("libtest2: I am weak function2!\n");
+}
+
+
+int libtest2_func(const char *s);
+int libtest2_func(const char *s)
+{
+ printf( "libtest2: function1 = %p\n"
+ "libtest2: function2 = %p\n",
+ function1, function2);
+ function1();
+ function2();
+ return 0;
+}