diff options
author | Brad King <brad.king@kitware.com> | 2017-05-16 15:39:01 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2017-05-16 15:39:01 (GMT) |
commit | 16ebd9f6152fedd1804f13c91ed14e8963e53d3f (patch) | |
tree | a29304959eb94ee499148f7436e161e5a02fb262 /Source/kwsys/DynamicLoader.cxx | |
parent | 6b05e028f1a3afc7906908bd48d58993da02a9d9 (diff) | |
parent | 7be70ca6cc888df532d2f1560e74d13642730ee5 (diff) | |
download | CMake-16ebd9f6152fedd1804f13c91ed14e8963e53d3f.zip CMake-16ebd9f6152fedd1804f13c91ed14e8963e53d3f.tar.gz CMake-16ebd9f6152fedd1804f13c91ed14e8963e53d3f.tar.bz2 |
Merge branch 'upstream-KWSys' into update-kwsys
* upstream-KWSys:
KWSys 2017-05-16 (fe1f22ce)
Diffstat (limited to 'Source/kwsys/DynamicLoader.cxx')
-rw-r--r-- | Source/kwsys/DynamicLoader.cxx | 34 |
1 files changed, 0 insertions, 34 deletions
diff --git a/Source/kwsys/DynamicLoader.cxx b/Source/kwsys/DynamicLoader.cxx index e494db6..1b4596a 100644 --- a/Source/kwsys/DynamicLoader.cxx +++ b/Source/kwsys/DynamicLoader.cxx @@ -26,20 +26,17 @@ // the static methods of DynamicLoader. #if !KWSYS_SUPPORTS_SHARED_LIBS -//---------------------------------------------------------------------------- // Implementation for environments without dynamic libs #include <string.h> // for strerror() namespace KWSYS_NAMESPACE { -//---------------------------------------------------------------------------- DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary( const std::string& libname) { return 0; } -//---------------------------------------------------------------------------- int DynamicLoader::CloseLibrary(DynamicLoader::LibraryHandle lib) { if (!lib) { @@ -49,14 +46,12 @@ int DynamicLoader::CloseLibrary(DynamicLoader::LibraryHandle lib) return 1; } -//---------------------------------------------------------------------------- DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress( DynamicLoader::LibraryHandle lib, const std::string& sym) { return 0; } -//---------------------------------------------------------------------------- const char* DynamicLoader::LastError() { return "General error"; @@ -65,21 +60,18 @@ const char* DynamicLoader::LastError() } // namespace KWSYS_NAMESPACE #elif defined(__hpux) -//---------------------------------------------------------------------------- // Implementation for HPUX machines #include <dl.h> #include <errno.h> namespace KWSYS_NAMESPACE { -//---------------------------------------------------------------------------- DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary( const std::string& libname) { return shl_load(libname.c_str(), BIND_DEFERRED | DYNAMIC_PATH, 0L); } -//---------------------------------------------------------------------------- int DynamicLoader::CloseLibrary(DynamicLoader::LibraryHandle lib) { if (!lib) { @@ -88,7 +80,6 @@ int DynamicLoader::CloseLibrary(DynamicLoader::LibraryHandle lib) return !shl_unload(lib); } -//---------------------------------------------------------------------------- DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress( DynamicLoader::LibraryHandle lib, const std::string& sym) { @@ -132,14 +123,12 @@ const char* DynamicLoader::LastError() } // namespace KWSYS_NAMESPACE #elif defined(__APPLE__) && (MAC_OS_X_VERSION_MAX_ALLOWED < 1030) -//---------------------------------------------------------------------------- // Implementation for Mac OS X 10.2.x and earlier #include <mach-o/dyld.h> #include <string.h> // for strlen namespace KWSYS_NAMESPACE { -//---------------------------------------------------------------------------- DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary( const std::string& libname) { @@ -158,7 +147,6 @@ DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary( return handle; } -//---------------------------------------------------------------------------- int DynamicLoader::CloseLibrary(DynamicLoader::LibraryHandle lib) { // NSUNLINKMODULE_OPTION_KEEP_MEMORY_MAPPED @@ -170,7 +158,6 @@ int DynamicLoader::CloseLibrary(DynamicLoader::LibraryHandle lib) return success; } -//---------------------------------------------------------------------------- DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress( DynamicLoader::LibraryHandle lib, const std::string& sym) { @@ -191,7 +178,6 @@ DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress( return *reinterpret_cast<DynamicLoader::SymbolPointer*>(&result); } -//---------------------------------------------------------------------------- const char* DynamicLoader::LastError() { return 0; @@ -200,13 +186,11 @@ const char* DynamicLoader::LastError() } // namespace KWSYS_NAMESPACE #elif defined(_WIN32) && !defined(__CYGWIN__) -//---------------------------------------------------------------------------- // Implementation for Windows win32 code but not cygwin #include <windows.h> namespace KWSYS_NAMESPACE { -//---------------------------------------------------------------------------- DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary( const std::string& libname) { @@ -220,13 +204,11 @@ DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary( return lh; } -//---------------------------------------------------------------------------- int DynamicLoader::CloseLibrary(DynamicLoader::LibraryHandle lib) { return (int)FreeLibrary(lib); } -//---------------------------------------------------------------------------- DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress( DynamicLoader::LibraryHandle lib, const std::string& sym) { @@ -274,7 +256,6 @@ DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress( #endif } -//---------------------------------------------------------------------------- const char* DynamicLoader::LastError() { LPVOID lpMsgBuf = NULL; @@ -299,7 +280,6 @@ const char* DynamicLoader::LastError() } // namespace KWSYS_NAMESPACE #elif defined(__BEOS__) -//---------------------------------------------------------------------------- // Implementation for BeOS / Haiku #include <string.h> // for strerror() @@ -310,7 +290,6 @@ namespace KWSYS_NAMESPACE { static image_id last_dynamic_err = B_OK; -//---------------------------------------------------------------------------- DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary( const std::string& libname) { @@ -325,7 +304,6 @@ DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary( return rc + 1; } -//---------------------------------------------------------------------------- int DynamicLoader::CloseLibrary(DynamicLoader::LibraryHandle lib) { if (!lib) { @@ -343,7 +321,6 @@ int DynamicLoader::CloseLibrary(DynamicLoader::LibraryHandle lib) return 1; } -//---------------------------------------------------------------------------- DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress( DynamicLoader::LibraryHandle lib, const std::string& sym) { @@ -372,7 +349,6 @@ DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress( return result.psym; } -//---------------------------------------------------------------------------- const char* DynamicLoader::LastError() { const char* retval = strerror(last_dynamic_err); @@ -383,7 +359,6 @@ const char* DynamicLoader::LastError() } // namespace KWSYS_NAMESPACE #elif defined(__MINT__) -//---------------------------------------------------------------------------- // Implementation for FreeMiNT on Atari #define _GNU_SOURCE /* for program_invocation_name */ #include <dld.h> @@ -393,7 +368,6 @@ const char* DynamicLoader::LastError() namespace KWSYS_NAMESPACE { -//---------------------------------------------------------------------------- DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary( const std::string& libname) { @@ -404,7 +378,6 @@ DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary( return (void*)name; } -//---------------------------------------------------------------------------- int DynamicLoader::CloseLibrary(DynamicLoader::LibraryHandle lib) { dld_unlink_by_file((char*)lib, 0); @@ -412,7 +385,6 @@ int DynamicLoader::CloseLibrary(DynamicLoader::LibraryHandle lib) return 0; } -//---------------------------------------------------------------------------- DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress( DynamicLoader::LibraryHandle lib, const std::string& sym) { @@ -426,7 +398,6 @@ DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress( return result.psym; } -//---------------------------------------------------------------------------- const char* DynamicLoader::LastError() { return dld_strerror(dld_errno); @@ -435,21 +406,18 @@ const char* DynamicLoader::LastError() } // namespace KWSYS_NAMESPACE #else -//---------------------------------------------------------------------------- // Default implementation for *NIX systems (including Mac OS X 10.3 and // later) which use dlopen #include <dlfcn.h> namespace KWSYS_NAMESPACE { -//---------------------------------------------------------------------------- DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary( const std::string& libname) { return dlopen(libname.c_str(), RTLD_LAZY); } -//---------------------------------------------------------------------------- int DynamicLoader::CloseLibrary(DynamicLoader::LibraryHandle lib) { if (lib) { @@ -460,7 +428,6 @@ int DynamicLoader::CloseLibrary(DynamicLoader::LibraryHandle lib) return 0; } -//---------------------------------------------------------------------------- DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress( DynamicLoader::LibraryHandle lib, const std::string& sym) { @@ -474,7 +441,6 @@ DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress( return result.psym; } -//---------------------------------------------------------------------------- const char* DynamicLoader::LastError() { return dlerror(); |