From 7f01fbc3db348916f0908fa54dccfb762a32570d Mon Sep 17 00:00:00 2001 From: FrancisANDRE Date: Thu, 27 Aug 2015 08:48:26 +0200 Subject: [PATCH] add std::string SharedLibrary::prefix() for building library name that complies with Cygwin standard. Signed-off-by: FrancisANDRE --- Foundation/include/Poco/SharedLibrary.h | 6 ++++++ Foundation/include/Poco/SharedLibrary_HPUX.h | 1 + Foundation/include/Poco/SharedLibrary_UNIX.h | 1 + Foundation/include/Poco/SharedLibrary_VMS.h | 1 + Foundation/include/Poco/SharedLibrary_VX.h | 1 + Foundation/include/Poco/SharedLibrary_WIN32.h | 1 + Foundation/include/Poco/SharedLibrary_WIN32U.h | 1 + Foundation/src/SharedLibrary.cpp | 6 ++++++ Foundation/src/SharedLibrary_HPUX.cpp | 6 ++++++ Foundation/src/SharedLibrary_UNIX.cpp | 18 ++++++++++++++---- Foundation/src/SharedLibrary_VMS.cpp | 6 ++++++ Foundation/src/SharedLibrary_VX.cpp | 6 ++++++ Foundation/src/SharedLibrary_WIN32.cpp | 6 ++++++ Foundation/src/SharedLibrary_WIN32U.cpp | 6 ++++++ 14 files changed, 62 insertions(+), 4 deletions(-) diff --git a/Foundation/include/Poco/SharedLibrary.h b/Foundation/include/Poco/SharedLibrary.h index d34349f64..e8a7b19da 100644 --- a/Foundation/include/Poco/SharedLibrary.h +++ b/Foundation/include/Poco/SharedLibrary.h @@ -118,6 +118,12 @@ public: /// specified in a call to load() or the /// constructor. + static std::string prefix(); + /// Returns the platform-specific filename prefix + /// for shared libraries. + /// Most platforms would return an empty string, but + /// on Cygwin, the "cyg" prefix will be returned. + static std::string suffix(); /// Returns the platform-specific filename suffix /// for shared libraries (including the period). diff --git a/Foundation/include/Poco/SharedLibrary_HPUX.h b/Foundation/include/Poco/SharedLibrary_HPUX.h index f77b02ae6..a25f825e5 100644 --- a/Foundation/include/Poco/SharedLibrary_HPUX.h +++ b/Foundation/include/Poco/SharedLibrary_HPUX.h @@ -38,6 +38,7 @@ protected: bool isLoadedImpl() const; void* findSymbolImpl(const std::string& name); const std::string& getPathImpl() const; + static std::string prefixImpl(); static std::string suffixImpl(); private: diff --git a/Foundation/include/Poco/SharedLibrary_UNIX.h b/Foundation/include/Poco/SharedLibrary_UNIX.h index ee968d1d2..a6eed76d1 100644 --- a/Foundation/include/Poco/SharedLibrary_UNIX.h +++ b/Foundation/include/Poco/SharedLibrary_UNIX.h @@ -43,6 +43,7 @@ protected: bool isLoadedImpl() const; void* findSymbolImpl(const std::string& name); const std::string& getPathImpl() const; + static std::string prefixImpl(); static std::string suffixImpl(); private: diff --git a/Foundation/include/Poco/SharedLibrary_VMS.h b/Foundation/include/Poco/SharedLibrary_VMS.h index 8cb701fcf..096cef6af 100644 --- a/Foundation/include/Poco/SharedLibrary_VMS.h +++ b/Foundation/include/Poco/SharedLibrary_VMS.h @@ -37,6 +37,7 @@ protected: bool isLoadedImpl() const; void* findSymbolImpl(const std::string& name); const std::string& getPathImpl() const; + static std::string prefixImpl(); static std::string suffixImpl(); private: diff --git a/Foundation/include/Poco/SharedLibrary_VX.h b/Foundation/include/Poco/SharedLibrary_VX.h index ef1502310..e76a3fcea 100644 --- a/Foundation/include/Poco/SharedLibrary_VX.h +++ b/Foundation/include/Poco/SharedLibrary_VX.h @@ -38,6 +38,7 @@ protected: bool isLoadedImpl() const; void* findSymbolImpl(const std::string& name); const std::string& getPathImpl() const; + static std::string prefixImpl(); static std::string suffixImpl(); private: diff --git a/Foundation/include/Poco/SharedLibrary_WIN32.h b/Foundation/include/Poco/SharedLibrary_WIN32.h index e949ab323..61550c2ad 100644 --- a/Foundation/include/Poco/SharedLibrary_WIN32.h +++ b/Foundation/include/Poco/SharedLibrary_WIN32.h @@ -37,6 +37,7 @@ protected: bool isLoadedImpl() const; void* findSymbolImpl(const std::string& name); const std::string& getPathImpl() const; + static std::string prefixImpl(); static std::string suffixImpl(); private: diff --git a/Foundation/include/Poco/SharedLibrary_WIN32U.h b/Foundation/include/Poco/SharedLibrary_WIN32U.h index f116ad341..66d447379 100644 --- a/Foundation/include/Poco/SharedLibrary_WIN32U.h +++ b/Foundation/include/Poco/SharedLibrary_WIN32U.h @@ -37,6 +37,7 @@ protected: bool isLoadedImpl() const; void* findSymbolImpl(const std::string& name); const std::string& getPathImpl() const; + static std::string prefixImpl(); static std::string suffixImpl(); private: diff --git a/Foundation/src/SharedLibrary.cpp b/Foundation/src/SharedLibrary.cpp index f847d9fb6..8ba80e9c4 100644 --- a/Foundation/src/SharedLibrary.cpp +++ b/Foundation/src/SharedLibrary.cpp @@ -104,6 +104,12 @@ const std::string& SharedLibrary::getPath() const } +std::string SharedLibrary::prefix() +{ + return prefixImpl(); +} + + std::string SharedLibrary::suffix() { return suffixImpl(); diff --git a/Foundation/src/SharedLibrary_HPUX.cpp b/Foundation/src/SharedLibrary_HPUX.cpp index a9998d460..25bc00460 100644 --- a/Foundation/src/SharedLibrary_HPUX.cpp +++ b/Foundation/src/SharedLibrary_HPUX.cpp @@ -83,6 +83,12 @@ const std::string& SharedLibraryImpl::getPathImpl() const } +std::string SharedLibraryImpl::prefixImpl() +{ + return ""; +} + + std::string SharedLibraryImpl::suffixImpl() { #if defined(_DEBUG) diff --git a/Foundation/src/SharedLibrary_UNIX.cpp b/Foundation/src/SharedLibrary_UNIX.cpp index 0153fabbe..663cb90b5 100644 --- a/Foundation/src/SharedLibrary_UNIX.cpp +++ b/Foundation/src/SharedLibrary_UNIX.cpp @@ -20,7 +20,7 @@ // Note: cygwin is missing RTLD_LOCAL, set it to 0 -#if defined(__CYGWIN__) && !defined(RTLD_LOCAL) +#if POCO_OS == POCO_OS_CYGWIN && !defined(RTLD_LOCAL) #define RTLD_LOCAL 0 #endif @@ -99,21 +99,31 @@ const std::string& SharedLibraryImpl::getPathImpl() const } +std::string SharedLibraryImpl::prefixImpl() +{ +#if POCO_OS == POCO_OS_CYGWIN + return "cyg"; +#else + return ""; +#endif +} + + std::string SharedLibraryImpl::suffixImpl() { -#if defined(__APPLE__) +#if POCO_OS == POCO_OS_MAC_OS_X #if defined(_DEBUG) return "d.dylib"; #else return ".dylib"; #endif -#elif defined(hpux) || defined(_hpux) +#elif POCO_OS == POCO_OS_HPUX #if defined(_DEBUG) return "d.sl"; #else return ".sl"; #endif -#elif defined(__CYGWIN__) +#elif POCO_OS == POCO_OS_CYGWIN #if defined(_DEBUG) return "d.dll"; #else diff --git a/Foundation/src/SharedLibrary_VMS.cpp b/Foundation/src/SharedLibrary_VMS.cpp index 3bd6ee0c0..92dac3d5b 100644 --- a/Foundation/src/SharedLibrary_VMS.cpp +++ b/Foundation/src/SharedLibrary_VMS.cpp @@ -106,6 +106,12 @@ const std::string& SharedLibraryImpl::getPathImpl() const } +std::string SharedLibraryImpl::prefixImpl() +{ + return ""; +} + + std::string SharedLibraryImpl::suffixImpl() { #if defined(_DEBUG) diff --git a/Foundation/src/SharedLibrary_VX.cpp b/Foundation/src/SharedLibrary_VX.cpp index 0901ff44a..573faeb76 100644 --- a/Foundation/src/SharedLibrary_VX.cpp +++ b/Foundation/src/SharedLibrary_VX.cpp @@ -128,6 +128,12 @@ const std::string& SharedLibraryImpl::getPathImpl() const } +std::string SharedLibraryImpl::prefixImpl() +{ + return ""; +} + + std::string SharedLibraryImpl::suffixImpl() { return ".out"; diff --git a/Foundation/src/SharedLibrary_WIN32.cpp b/Foundation/src/SharedLibrary_WIN32.cpp index ba7dabf2c..42751de1e 100644 --- a/Foundation/src/SharedLibrary_WIN32.cpp +++ b/Foundation/src/SharedLibrary_WIN32.cpp @@ -87,6 +87,12 @@ const std::string& SharedLibraryImpl::getPathImpl() const } +std::string SharedLibraryImpl::prefixImpl() +{ + return ""; +} + + std::string SharedLibraryImpl::suffixImpl() { #if defined(_DEBUG) diff --git a/Foundation/src/SharedLibrary_WIN32U.cpp b/Foundation/src/SharedLibrary_WIN32U.cpp index 650ac0513..2b50a0df6 100644 --- a/Foundation/src/SharedLibrary_WIN32U.cpp +++ b/Foundation/src/SharedLibrary_WIN32U.cpp @@ -98,6 +98,12 @@ const std::string& SharedLibraryImpl::getPathImpl() const } +std::string SharedLibraryImpl::prefixImpl() +{ + return ""; +} + + std::string SharedLibraryImpl::suffixImpl() { #if defined(_DEBUG)