summaryrefslogtreecommitdiff
path: root/test/dlopen/libtest1.c
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2003-06-27 11:55:20 +0000
committerEric Andersen <andersen@codepoet.org>2003-06-27 11:55:20 +0000
commit536362633fc9b7615f3cd2c0543e553c3e0f4cdf (patch)
treeab97f2c536859950e46416ce533e7838e423a153 /test/dlopen/libtest1.c
parentbdd703508d6c905db90739a78e58ec923f5c6ae1 (diff)
Add a test which shows off the broken spots in our dlopen implementation
Diffstat (limited to 'test/dlopen/libtest1.c')
-rw-r--r--test/dlopen/libtest1.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/test/dlopen/libtest1.c b/test/dlopen/libtest1.c
new file mode 100644
index 000000000..c440d9b4a
--- /dev/null
+++ b/test/dlopen/libtest1.c
@@ -0,0 +1,37 @@
+#include <stdio.h>
+
+extern int libtest2_func(const char *s);
+
+
+void __attribute__((constructor)) libtest1_ctor(void)
+{
+ printf("I am the libtest1 constructor!\n");
+}
+
+void __attribute__((destructor)) libtest1_dtor(void)
+{
+ printf("I am the libtest1 destructor!\n");
+}
+
+void __attribute__((weak)) function1(void)
+{
+ printf("libtest1: I am function1 from libtest1!\n");
+}
+
+void function2(void)
+{
+ printf("libtest1: I am overriding function2!\n");
+}
+
+
+int dltest(const char *s)
+{
+ printf( "libtest1: function1 = %p\n"
+ "libtest1: function2 = %p\n",
+ function1, function2);
+ function1();
+ function2();
+ return(libtest2_func(s));
+}
+
+