diff options
author | Andreas Baumann <abaumann@yahoo.com> | 2010-05-18 17:29:24 +0200 |
---|---|---|
committer | Andreas Baumann <abaumann@yahoo.com> | 2010-05-18 17:29:24 +0200 |
commit | 9d6b4ab6fee3d65f3a11a5f19c410e5abe4ba322 (patch) | |
tree | 77c5af1b4bf80c0eea8a23844cfb1872d211aba5 | |
parent | 78420e31a260353b1c34ca019c0c8cabd292cca6 (diff) | |
download | wolfbones-9d6b4ab6fee3d65f3a11a5f19c410e5abe4ba322.tar.gz wolfbones-9d6b4ab6fee3d65f3a11a5f19c410e5abe4ba322.tar.bz2 |
added building of the test library
-rw-r--r-- | include/wolf/library/loader.h | 2 | ||||
-rw-r--r-- | src/library/loader.c | 5 | ||||
-rw-r--r-- | tests/library/GNUmakefile | 8 | ||||
-rw-r--r-- | tests/library/test_loader.c | 4 | ||||
-rw-r--r-- | tests/library/testlib.c | 2 |
5 files changed, 16 insertions, 5 deletions
diff --git a/include/wolf/library/loader.h b/include/wolf/library/loader.h index 949d946..a2ee16e 100644 --- a/include/wolf/library/loader.h +++ b/include/wolf/library/loader.h @@ -72,7 +72,7 @@ wolf_error_t wolf_library_unload( wolf_library_p library ); * * @returns a pointer to buf for convenience */ -char *wolf_libary_errmsg( const wolf_error_t error, const wolf_library_p library, char *buf, size_t buflen ); +char *wolf_library_errmsg( const wolf_error_t error, const wolf_library_p library, char *buf, size_t buflen ); /** @} */ /* @addtogroup wolf_library */ diff --git a/src/library/loader.c b/src/library/loader.c index 77abf18..ad83bda 100644 --- a/src/library/loader.c +++ b/src/library/loader.c @@ -48,7 +48,7 @@ wolf_library_p wolf_library_load( const char *name, wolf_error_t *error ) { #if defined HAVE_DLFCN /* TODO: Apache has a flags variable and a direct parameter version, find out why.. - * also make up our bind how many flags we should "leak" to the application layer + * also make up our mind how many flags we should "leak" to the application layer */ flags = RTLD_NOW | RTLD_LOCAL; @@ -75,6 +75,7 @@ wolf_error_t wolf_library_unload( wolf_library_p l ) { res = dlclose( l->handle ); if( res != 0 ) { + strncpy( l->errbuf, dlerror( ), INTERNAL_ERRBUF_SIZE ); return WOLF_ERR_INTERNAL; } @@ -84,7 +85,7 @@ wolf_error_t wolf_library_unload( wolf_library_p l ) { return WOLF_OK; } -char *wolf_libary_errmsg( const wolf_error_t error, const wolf_library_p l, char *buf, size_t buflen ) { +char *wolf_library_errmsg( const wolf_error_t error, const wolf_library_p l, char *buf, size_t buflen ) { (void)wolf_error_msg( error, buf, buflen ); strncat( buf, " - ", buflen - strlen( buf ) ); if( error == WOLF_ERR_INTERNAL ) { diff --git a/tests/library/GNUmakefile b/tests/library/GNUmakefile index 18ae8aa..18e69f7 100644 --- a/tests/library/GNUmakefile +++ b/tests/library/GNUmakefile @@ -9,6 +9,14 @@ INCLUDE_LIBS = \ TEST_BINS = \ test_loader$(EXE) +DYNAMIC_LIB = testlib.so +DYNAMIC_LIB_MAJOR = 0 +DYNAMIC_LIB_MINOR = 0 +DYNAMIC_LIB_PATCH = 0 + +OBJS = \ + testlib.o + -include $(TOPDIR)/makefiles/gmake/sub.mk local_all: diff --git a/tests/library/test_loader.c b/tests/library/test_loader.c index 46d2ad0..6088c92 100644 --- a/tests/library/test_loader.c +++ b/tests/library/test_loader.c @@ -25,10 +25,10 @@ int main( void ) { wolf_error_t error; char errbuf[512]; - library = wolf_library_load( "testlib.so", &error ); + library = wolf_library_load( "./testlib.so.0.0.0", &error ); if( error != WOLF_OK ) { fprintf( stderr, "Error %d loading the library: %s\n", - error, wolf_libary_errmsg( error, library, errbuf, 512 ) ); + error, wolf_library_errmsg( error, library, errbuf, 512 ) ); return EXIT_FAILURE; } diff --git a/tests/library/testlib.c b/tests/library/testlib.c index ee97b87..f8e457a 100644 --- a/tests/library/testlib.c +++ b/tests/library/testlib.c @@ -1,3 +1,5 @@ +int multiply_by_two( int a ); + int multiply_by_two( int a ) { return a * 2; } |