diff options
author | Brad King <brad.king@kitware.com> | 2002-09-10 19:46:49 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2002-09-10 19:46:49 (GMT) |
commit | 820088cefc2831a887c141dc4daf6dd758c4c365 (patch) | |
tree | 5a65c177bbc95c43dc6ef55844dc3b283adc3ad4 /Source/cmDynamicLoader.cxx | |
parent | de48dbbf7cb77315645566f14bed088d44585546 (diff) | |
download | CMake-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.cxx | 56 |
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"; |