diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/library/loader.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/library/loader.c b/src/library/loader.c index 1f8ce20..173607c 100644 --- a/src/library/loader.c +++ b/src/library/loader.c @@ -20,6 +20,8 @@ #include "port/unused.h" #include "port/stdlib.h" /* for malloc, free */ +#include "port/stdio.h" /* for snprintf */ +#include "port/gettext.h" /* for i18n */ #ifdef HAVE_DLFCN #include <dlfcn.h> /* for dlopen. dlclose functions */ @@ -75,3 +77,22 @@ 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 library, char *buf, size_t buflen ) { + switch( error ) { + /* TODO: we repeat ourself here! Have a function in errors.h for generic mapping? */ + case WOLF_ERR_OUT_OF_MEMORY: + snprintf( buf, buflen, _( "Out of memory" ) ); + break; + + case WOLF_ERR_INVALID_STATE: + snprintf( buf, buflen, _( "Invalid state" ) ); + break; + + default: + snprintf( buf, buflen, _( "<unknown error>" ) ); + break; + } + + return buf; +} |