summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAndreas Baumann <abaumann@yahoo.com>2010-05-20 17:30:26 +0200
committerAndreas Baumann <abaumann@yahoo.com>2010-05-20 17:30:26 +0200
commiteca7b5dbd6929a75075372cc4be2c6b376d9cb17 (patch)
treea586b9439bd3245f3375ed5b128c593a1c198957 /include
parent0718a3222ad1cf0e9bf85947f6a32b106cdb2ee4 (diff)
downloadwolfbones-eca7b5dbd6929a75075372cc4be2c6b376d9cb17.tar.gz
wolfbones-eca7b5dbd6929a75075372cc4be2c6b376d9cb17.tar.bz2
final solution of library loader
Diffstat (limited to 'include')
-rw-r--r--include/wolf/library/loader.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/include/wolf/library/loader.h b/include/wolf/library/loader.h
index 11d5741..19979af 100644
--- a/include/wolf/library/loader.h
+++ b/include/wolf/library/loader.h
@@ -54,6 +54,22 @@ typedef struct wolf_library_t *wolf_library_p;
#define WOLF_LIBRARY_FUNCPTR void *
#endif
+/* @brief casts a library symbol to a function pointer of a given type.
+ *
+ * Reason: conversion from void * to function pointer is illegal by ISO-99
+ * (though it works actually on Posix)
+ */
+#if defined _WIN32
+#define WOLF_LIBRARY_FUNC_CAST( symbol__, func_t__, func__ ) func__ = (func_t__)symbol__
+#else
+#define WOLF_LIBRARY_FUNC_CAST( symbol__, func_t__, func__ ) \
+ { \
+ union { func_t__ f__; void *s__; } alias__; \
+ alias__.s__ = symbol__; \
+ func__ = alias__.f__; \
+ }
+#endif
+
/**
* Loads a shared library.
*