summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAndreas Baumann <abaumann@yahoo.com>2010-05-20 16:40:40 +0200
committerAndreas Baumann <abaumann@yahoo.com>2010-05-20 16:40:40 +0200
commit34a193a606ce61f7d84e4417b198a5a05b9c8e38 (patch)
tree3e32e65f996edb7cfe08d05fbb00ee9af0b2fe5b /include
parent82c2b858633c9992ce7560a0b21f37329904a300 (diff)
downloadwolfbones-34a193a606ce61f7d84e4417b198a5a05b9c8e38.tar.gz
wolfbones-34a193a606ce61f7d84e4417b198a5a05b9c8e38.tar.bz2
more portable way of returning the function pointer in the dynloader
Diffstat (limited to 'include')
-rw-r--r--include/wolf/library/loader.h16
1 files changed, 14 insertions, 2 deletions
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 <stddef.h> /* for size_t */
+#if defined _WIN32
+#define WIN32_MEAN_AND_LEAN
+#include <windows.h>
+#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 */