add std::string SharedLibrary::prefix() for building library name that

complies with Cygwin standard.

Signed-off-by: FrancisANDRE <zosrothko@orange.fr>
This commit is contained in:
FrancisANDRE
2015-08-27 08:48:26 +02:00
parent b0989b0828
commit 7f01fbc3db
14 changed files with 62 additions and 4 deletions

View File

@@ -118,6 +118,12 @@ public:
/// specified in a call to load() or the /// specified in a call to load() or the
/// constructor. /// 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(); static std::string suffix();
/// Returns the platform-specific filename suffix /// Returns the platform-specific filename suffix
/// for shared libraries (including the period). /// for shared libraries (including the period).

View File

@@ -38,6 +38,7 @@ protected:
bool isLoadedImpl() const; bool isLoadedImpl() const;
void* findSymbolImpl(const std::string& name); void* findSymbolImpl(const std::string& name);
const std::string& getPathImpl() const; const std::string& getPathImpl() const;
static std::string prefixImpl();
static std::string suffixImpl(); static std::string suffixImpl();
private: private:

View File

@@ -43,6 +43,7 @@ protected:
bool isLoadedImpl() const; bool isLoadedImpl() const;
void* findSymbolImpl(const std::string& name); void* findSymbolImpl(const std::string& name);
const std::string& getPathImpl() const; const std::string& getPathImpl() const;
static std::string prefixImpl();
static std::string suffixImpl(); static std::string suffixImpl();
private: private:

View File

@@ -37,6 +37,7 @@ protected:
bool isLoadedImpl() const; bool isLoadedImpl() const;
void* findSymbolImpl(const std::string& name); void* findSymbolImpl(const std::string& name);
const std::string& getPathImpl() const; const std::string& getPathImpl() const;
static std::string prefixImpl();
static std::string suffixImpl(); static std::string suffixImpl();
private: private:

View File

@@ -38,6 +38,7 @@ protected:
bool isLoadedImpl() const; bool isLoadedImpl() const;
void* findSymbolImpl(const std::string& name); void* findSymbolImpl(const std::string& name);
const std::string& getPathImpl() const; const std::string& getPathImpl() const;
static std::string prefixImpl();
static std::string suffixImpl(); static std::string suffixImpl();
private: private:

View File

@@ -37,6 +37,7 @@ protected:
bool isLoadedImpl() const; bool isLoadedImpl() const;
void* findSymbolImpl(const std::string& name); void* findSymbolImpl(const std::string& name);
const std::string& getPathImpl() const; const std::string& getPathImpl() const;
static std::string prefixImpl();
static std::string suffixImpl(); static std::string suffixImpl();
private: private:

View File

@@ -37,6 +37,7 @@ protected:
bool isLoadedImpl() const; bool isLoadedImpl() const;
void* findSymbolImpl(const std::string& name); void* findSymbolImpl(const std::string& name);
const std::string& getPathImpl() const; const std::string& getPathImpl() const;
static std::string prefixImpl();
static std::string suffixImpl(); static std::string suffixImpl();
private: private:

View File

@@ -104,6 +104,12 @@ const std::string& SharedLibrary::getPath() const
} }
std::string SharedLibrary::prefix()
{
return prefixImpl();
}
std::string SharedLibrary::suffix() std::string SharedLibrary::suffix()
{ {
return suffixImpl(); return suffixImpl();

View File

@@ -83,6 +83,12 @@ const std::string& SharedLibraryImpl::getPathImpl() const
} }
std::string SharedLibraryImpl::prefixImpl()
{
return "";
}
std::string SharedLibraryImpl::suffixImpl() std::string SharedLibraryImpl::suffixImpl()
{ {
#if defined(_DEBUG) #if defined(_DEBUG)

View File

@@ -20,7 +20,7 @@
// Note: cygwin is missing RTLD_LOCAL, set it to 0 // 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 #define RTLD_LOCAL 0
#endif #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() std::string SharedLibraryImpl::suffixImpl()
{ {
#if defined(__APPLE__) #if POCO_OS == POCO_OS_MAC_OS_X
#if defined(_DEBUG) #if defined(_DEBUG)
return "d.dylib"; return "d.dylib";
#else #else
return ".dylib"; return ".dylib";
#endif #endif
#elif defined(hpux) || defined(_hpux) #elif POCO_OS == POCO_OS_HPUX
#if defined(_DEBUG) #if defined(_DEBUG)
return "d.sl"; return "d.sl";
#else #else
return ".sl"; return ".sl";
#endif #endif
#elif defined(__CYGWIN__) #elif POCO_OS == POCO_OS_CYGWIN
#if defined(_DEBUG) #if defined(_DEBUG)
return "d.dll"; return "d.dll";
#else #else

View File

@@ -106,6 +106,12 @@ const std::string& SharedLibraryImpl::getPathImpl() const
} }
std::string SharedLibraryImpl::prefixImpl()
{
return "";
}
std::string SharedLibraryImpl::suffixImpl() std::string SharedLibraryImpl::suffixImpl()
{ {
#if defined(_DEBUG) #if defined(_DEBUG)

View File

@@ -128,6 +128,12 @@ const std::string& SharedLibraryImpl::getPathImpl() const
} }
std::string SharedLibraryImpl::prefixImpl()
{
return "";
}
std::string SharedLibraryImpl::suffixImpl() std::string SharedLibraryImpl::suffixImpl()
{ {
return ".out"; return ".out";

View File

@@ -87,6 +87,12 @@ const std::string& SharedLibraryImpl::getPathImpl() const
} }
std::string SharedLibraryImpl::prefixImpl()
{
return "";
}
std::string SharedLibraryImpl::suffixImpl() std::string SharedLibraryImpl::suffixImpl()
{ {
#if defined(_DEBUG) #if defined(_DEBUG)

View File

@@ -98,6 +98,12 @@ const std::string& SharedLibraryImpl::getPathImpl() const
} }
std::string SharedLibraryImpl::prefixImpl()
{
return "";
}
std::string SharedLibraryImpl::suffixImpl() std::string SharedLibraryImpl::suffixImpl()
{ {
#if defined(_DEBUG) #if defined(_DEBUG)