From 458fa7559be7f0f2376262897cfae866e25a08d5 Mon Sep 17 00:00:00 2001 From: Mathieu Malaterre Date: Fri, 8 Dec 2006 15:52:30 -0500 Subject: [PATCH] BUG: Make sure to use the Win32 interface (HINSTANCE) for handling shared lib on cygwin and mingw system --- Source/kwsys/CMakeLists.txt | 4 +++- Source/kwsys/DynamicLoader.cxx | 2 +- Source/kwsys/DynamicLoader.hxx.in | 4 ++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Source/kwsys/CMakeLists.txt b/Source/kwsys/CMakeLists.txt index b3febd2f5..69b536b79 100644 --- a/Source/kwsys/CMakeLists.txt +++ b/Source/kwsys/CMakeLists.txt @@ -718,7 +718,9 @@ IF(KWSYS_C_SRCS OR KWSYS_CXX_SRCS) ${KWSYS_C_SRCS} ${KWSYS_CXX_SRCS}) IF(KWSYS_USE_DynamicLoader) IF(UNIX) - TARGET_LINK_LIBRARIES(${KWSYS_NAMESPACE} ${CMAKE_DL_LIBS}) + IF(NOT CYGWIN AND NOT MINGW) + TARGET_LINK_LIBRARIES(${KWSYS_NAMESPACE} ${CMAKE_DL_LIBS}) + ENDIF(NOT CYGWIN AND NOT MINGW) ENDIF(UNIX) ENDIF(KWSYS_USE_DynamicLoader) diff --git a/Source/kwsys/DynamicLoader.cxx b/Source/kwsys/DynamicLoader.cxx index 87f957f3a..4b733224d 100644 --- a/Source/kwsys/DynamicLoader.cxx +++ b/Source/kwsys/DynamicLoader.cxx @@ -220,7 +220,7 @@ const char* DynamicLoader::LastError() // --------------------------------------------------------------- // 3. Implementation for Windows win32 code -#ifdef _WIN32 +#if defined(_WIN32) || defined(__CYGWIN__) || defined(__MINGW32__) #include #define DYNAMICLOADER_DEFINED 1 diff --git a/Source/kwsys/DynamicLoader.hxx.in b/Source/kwsys/DynamicLoader.hxx.in index 72dea57c3..75177cc8f 100644 --- a/Source/kwsys/DynamicLoader.hxx.in +++ b/Source/kwsys/DynamicLoader.hxx.in @@ -18,7 +18,7 @@ #if defined(__hpux) #include -#elif defined(_WIN32) +#elif defined(_WIN32) || defined(__CYGWIN__) || defined(__MINGW32__) #include #elif defined(__APPLE__) #include @@ -56,7 +56,7 @@ public: // They are different on several different OS's #if defined(__hpux) typedef shl_t LibraryHandle; -#elif defined(_WIN32) +#elif defined(_WIN32) || defined(__CYGWIN__) || defined(__MINGW32__) typedef HMODULE LibraryHandle; #elif defined(__APPLE__) #if MAC_OS_X_VERSION_MAX_ALLOWED < 1030