[uClibc-cvs] uClibc/test/dlopen test3.c, NONE, 1.1 Makefile, 1.1, 1.2 libtest1.c, 1.1, 1.2 libtest2.c, 1.1, 1.2
Erik Andersen
andersen at uclibc.org
Tue Aug 19 14:24:18 UTC 2003
Update of /var/cvs/uClibc/test/dlopen
In directory winder:/tmp/cvs-serv28064
Modified Files:
Makefile libtest1.c libtest2.c
Added Files:
test3.c
Log Message:
Update the tests a little bit
Index: libtest1.c
===================================================================
RCS file: /var/cvs/uClibc/test/dlopen/libtest1.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- libtest1.c 27 Jun 2003 11:55:20 -0000 1.1
+++ libtest1.c 19 Aug 2003 14:24:14 -0000 1.2
@@ -5,22 +5,22 @@
void __attribute__((constructor)) libtest1_ctor(void)
{
- printf("I am the libtest1 constructor!\n");
+ printf("libtest1: constructor!\n");
}
void __attribute__((destructor)) libtest1_dtor(void)
{
- printf("I am the libtest1 destructor!\n");
+ printf("libtest1: destructor!\n");
}
void __attribute__((weak)) function1(void)
{
- printf("libtest1: I am function1 from libtest1!\n");
+ printf("libtest1: I am weak function1!\n");
}
void function2(void)
{
- printf("libtest1: I am overriding function2!\n");
+ printf("libtest1: I am function2!\n");
}
Index: Makefile
===================================================================
RCS file: /var/cvs/uClibc/test/dlopen/Makefile,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- Makefile 27 Jun 2003 11:55:20 -0000 1.1
+++ Makefile 19 Aug 2003 14:24:14 -0000 1.2
@@ -27,6 +27,9 @@
test2: test2.c
$(CC) $(CFLAGS) -o test2 test2.c -ldl
+test3: test3.c
+ $(CC) $(CFLAGS) -o test3 test3.c -ldl ./libtest1.so ./libtest2.so
+
libtest1.o: libtest1.c
$(CC) $(CFLAGS) -fPIC -c libtest1.c -o libtest1.o
@@ -39,11 +42,13 @@
libtest2.so: libtest2.o
$(CC) $(CFLAGS) -fPIC -shared -o libtest2.so -Wl,-soname,libtest2.so libtest2.o
-run: libtest2.so libtest1.so test1 test2
+run: libtest2.so libtest1.so test1 test2 test3
@echo "----------running test 1--------------"
- -LD_LIBRARY_PATH=`pwd`:. ./test1
+ -LD_LIBRARY_PATH=`pwd`:. LD_DEBUG=all ./test1
@echo "----------running test 2--------------"
- -LD_LIBRARY_PATH=`pwd`:. ./test2
+ -LD_LIBRARY_PATH=`pwd`:. LD_DEBUG=all ./test2
+ @echo "----------running test 3--------------"
+ -LD_LIBRARY_PATH=`pwd`:. LD_DEBUG=all ./test3
clean:
- rm -f *.o libtest1.so* libtest2.so* test1 test2
+ rm -f *.o libtest1.so* libtest2.so* test1 test2 test3
--- NEW FILE: test3.c ---
#include <fcntl.h>
#include <stdlib.h>
#include <stdio.h>
#include <dlfcn.h>
extern int dltest(const char *s);
int main(int argc, char **argv)
{
dltest("hello world!");
return EXIT_SUCCESS;
}
Index: libtest2.c
===================================================================
RCS file: /var/cvs/uClibc/test/dlopen/libtest2.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- libtest2.c 27 Jun 2003 11:55:20 -0000 1.1
+++ libtest2.c 19 Aug 2003 14:24:14 -0000 1.2
@@ -6,33 +6,32 @@
void __attribute__((constructor)) libtest2_ctor(void)
{
- printf("I am the libtest2 constructor!\n");
+ printf("libtest2: constructor!\n");
}
void __attribute__((destructor)) libtest2_dtor(void)
{
- printf("I am the libtest2 destructor!\n");
+ printf("libtest2: destructor!\n");
}
void function1(void)
{
- printf("libtest2: I am overriding function1!\n");
+ printf("libtest2: I am function1!\n");
}
void __attribute__((weak)) function2(void)
{
- printf("libtest2: I am function2 from libtest2!\n");
+ printf("libtest2: I am weak function2!\n");
}
int libtest2_func(const char *s)
{
+ printf( "libtest2: function1 = %p\n"
+ "libtest2: function2 = %p\n",
+ function1, function2);
function1();
function2();
- printf( "libtest2: function1 = %p\n"
- "libtest2: function2 = %p\n"
- "libtest2: message from main() = '%s'\n",
- function1, function2, s);
return 0;
}
More information about the uClibc-cvs
mailing list