summaryrefslogtreecommitdiff
path: root/Source/cmDynamicLoader.h
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2002-09-10 15:46:49 -0400
committerBrad King <brad.king@kitware.com>2002-09-10 15:46:49 -0400
commit820088cefc2831a887c141dc4daf6dd758c4c365 (patch)
tree5a65c177bbc95c43dc6ef55844dc3b283adc3ad4 /Source/cmDynamicLoader.h
parentde48dbbf7cb77315645566f14bed088d44585546 (diff)
downloadcmake-820088cefc2831a887c141dc4daf6dd758c4c365.tar.gz
ERR: Cast from pointer-to-data to pointer-to-function is not allowed in C++. The cast needed by cmDynamicLoader::GetSymbolAddress is now hidden in a C file.
Diffstat (limited to 'Source/cmDynamicLoader.h')
-rw-r--r--Source/cmDynamicLoader.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/Source/cmDynamicLoader.h b/Source/cmDynamicLoader.h
index d5cc61246c..7c49f90978 100644
--- a/Source/cmDynamicLoader.h
+++ b/Source/cmDynamicLoader.h
@@ -37,6 +37,17 @@
typedef void* cmLibHandle;
#endif
+// C++ Does not allow casts from pointer-to-data types to
+// pointer-to-function types. However, the return type from each
+// platform's symbol lookup implementation is void*. We need to hide
+// the cast from void* to a pointer-to-function type in C code. The
+// implementation of cmDynamicLoader::GetSymbolAddress simply calls a
+// C-based implementation in cmDynamicLoaderC.c. This
+// cmDynamicLoaderFunction type is the return type of
+// cmDynamicLoader::GetSymbolAddress and can be cast to any other
+// pointer-to-function type safely in C++.
+extern "C" { typedef void (*cmDynamicLoaderFunction)(); }
+
class cmDynamicLoader
{
public:
@@ -53,7 +64,7 @@ public:
// Description:
// Find the address of the symbol in the given library
- static void* GetSymbolAddress(cmLibHandle, const char*);
+ static cmDynamicLoaderFunction GetSymbolAddress(cmLibHandle, const char*);
// Description:
// Return the library prefix for the given architecture