From 34a193a606ce61f7d84e4417b198a5a05b9c8e38 Mon Sep 17 00:00:00 2001 From: Andreas Baumann Date: Thu, 20 May 2010 16:40:40 +0200 Subject: more portable way of returning the function pointer in the dynloader --- include/wolf/library/loader.h | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/wolf/library/loader.h b/include/wolf/library/loader.h index 76cf5ee..11d5741 100644 --- a/include/wolf/library/loader.h +++ b/include/wolf/library/loader.h @@ -38,10 +38,22 @@ extern "C" { #include "errors.h" #include /* for size_t */ +#if defined _WIN32 +#define WIN32_MEAN_AND_LEAN +#include +#endif + /* @brief handle representing a shared library */ typedef struct wolf_library_t *wolf_library_p; +/* @brief returned by wolf_library_get_func, cast it to the custom function pointer */ +#ifdef _WIN32 +#define WOLF_LIBRARY_FUNCPTR FARPROC +#else +#define WOLF_LIBRARY_FUNCPTR void * +#endif + /** * Loads a shared library. * @@ -75,7 +87,7 @@ wolf_error_t wolf_library_unload( wolf_library_p library ); char *wolf_library_errmsg( const wolf_error_t error, const wolf_library_p library, char *buf, size_t buflen ); /** - * Gets a symbol (usually a function) from the library object. It has to be + * Gets a symbol (a function) from the library object. It has to be * casted properly to the function you are expecting to call. * * @param library the library object @@ -84,7 +96,7 @@ char *wolf_library_errmsg( const wolf_error_t error, const wolf_library_p librar * * @return a pointer to the retrieved symbol */ -void *wolf_library_get( const wolf_library_p library, const char *name, wolf_error_t *error ); +WOLF_LIBRARY_FUNCPTR wolf_library_get_func( const wolf_library_p library, const char *name, wolf_error_t *error ); /** @} */ /* @addtogroup wolf_library */ -- cgit v1.2.3-54-g00ecf