summaryrefslogtreecommitdiffstats
path: root/Source/cmDynamicLoader.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2002-09-10 19:46:49 (GMT)
committerBrad King <brad.king@kitware.com>2002-09-10 19:46:49 (GMT)
commit820088cefc2831a887c141dc4daf6dd758c4c365 (patch)
tree5a65c177bbc95c43dc6ef55844dc3b283adc3ad4 /Source/cmDynamicLoader.cxx
parentde48dbbf7cb77315645566f14bed088d44585546 (diff)
downloadCMake-820088cefc2831a887c141dc4daf6dd758c4c365.zip
CMake-820088cefc2831a887c141dc4daf6dd758c4c365.tar.gz
CMake-820088cefc2831a887c141dc4daf6dd758c4c365.tar.bz2
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.cxx')
-rw-r--r--Source/cmDynamicLoader.cxx56
1 files changed, 14 insertions, 42 deletions
diff --git a/Source/cmDynamicLoader.cxx b/Source/cmDynamicLoader.cxx
index 3422dac..891f4c2 100644
--- a/Source/cmDynamicLoader.cxx
+++ b/Source/cmDynamicLoader.cxx
@@ -16,7 +16,20 @@
=========================================================================*/
#include "cmDynamicLoader.h"
-// This file is actually 3 different implementations.
+extern "C"
+{
+cmDynamicLoaderFunction cmDynamicLoaderGetSymbolAddress(cmLibHandle,
+ const char*);
+}
+
+// Dispatch to C implementation.
+cmDynamicLoaderFunction cmDynamicLoader::GetSymbolAddress(cmLibHandle lib,
+ const char* sym)
+{
+ return cmDynamicLoaderGetSymbolAddress(lib, sym);
+}
+
+// This file is actually 4 different implementations.
// 1. HP machines which uses shl_load
// 2. Apple OSX which uses NSLinkModule
// 3. Windows which uses LoadLibrary
@@ -40,15 +53,6 @@ int cmDynamicLoader::CloseLibrary(cmLibHandle lib)
return 0;
}
-void* cmDynamicLoader::GetSymbolAddress(cmLibHandle lib, const char* sym)
-{
- void* addr;
- int status;
-
- status = shl_findsym (&lib, sym, TYPE_PROCEDURE, &addr);
- return (status < 0) ? (void*)0 : addr;
-}
-
const char* cmDynamicLoader::LibPrefix()
{
return "lib";
@@ -88,20 +92,6 @@ int cmDynamicLoader::CloseLibrary(cmLibHandle lib)
return 0;
}
-void* cmDynamicLoader::GetSymbolAddress(cmLibHandle lib, const char* sym)
-{
- void *result=0;
- if(NSIsSymbolNameDefined(sym))
- {
- NSSymbol symbol= NSLookupAndBindSymbol(sym);
- if(symbol)
- {
- result = NSAddressOfSymbol(symbol);
- }
- }
- return result;
-}
-
const char* cmDynamicLoader::LibPrefix()
{
return "";
@@ -146,19 +136,6 @@ int cmDynamicLoader::CloseLibrary(cmLibHandle lib)
return (int)FreeLibrary(lib);
}
-void* cmDynamicLoader::GetSymbolAddress(cmLibHandle lib, const char* sym)
-{
-#ifdef UNICODE
- wchar_t *wsym = new wchar_t [mbstowcs(NULL, sym, 32000)];
- mbstowcs(wsym, sym, 32000);
- void *ret = GetProcAddress(lib, wsym);
- delete [] wsym;
- return ret;
-#else
- return GetProcAddress(lib, sym);
-#endif
-}
-
const char* cmDynamicLoader::LibPrefix()
{
return "";
@@ -211,11 +188,6 @@ int cmDynamicLoader::CloseLibrary(cmLibHandle lib)
return (int)dlclose(lib);
}
-void* cmDynamicLoader::GetSymbolAddress(cmLibHandle lib, const char* sym)
-{
- return dlsym(lib, sym);
-}
-
const char* cmDynamicLoader::LibPrefix()
{
return "lib";