mirror of
https://github.com/pocoproject/poco.git
synced 2024-12-13 18:45:10 +01:00
added SharedLibrary::setSearchPath()
This commit is contained in:
parent
df4cb29ea5
commit
325cfcb3c2
@ -122,6 +122,16 @@ public:
|
|||||||
/// (e.g., "d.so", "d.dll") unless the library has
|
/// (e.g., "d.so", "d.dll") unless the library has
|
||||||
/// been compiled with -DPOCO_NO_SHARED_LIBRARY_DEBUG_SUFFIX.
|
/// been compiled with -DPOCO_NO_SHARED_LIBRARY_DEBUG_SUFFIX.
|
||||||
|
|
||||||
|
static bool setSearchPath(const std::string& path);
|
||||||
|
/// Adds the given path to the list of paths shared libraries
|
||||||
|
/// are searched in.
|
||||||
|
///
|
||||||
|
/// Returns true if the path was set, otherwise false.
|
||||||
|
///
|
||||||
|
/// Currently only supported on Windows, where it calls
|
||||||
|
/// SetDllDirectory(). On all other platforms, does not
|
||||||
|
/// do anything and returns false.
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SharedLibrary(const SharedLibrary&);
|
SharedLibrary(const SharedLibrary&);
|
||||||
SharedLibrary& operator = (const SharedLibrary&);
|
SharedLibrary& operator = (const SharedLibrary&);
|
||||||
|
@ -37,6 +37,7 @@ protected:
|
|||||||
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 suffixImpl();
|
static std::string suffixImpl();
|
||||||
|
static bool setSearchPathImpl(const std::string& path);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string _path;
|
std::string _path;
|
||||||
|
@ -42,6 +42,7 @@ protected:
|
|||||||
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 suffixImpl();
|
static std::string suffixImpl();
|
||||||
|
static bool setSearchPathImpl(const std::string& path);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string _path;
|
std::string _path;
|
||||||
|
@ -37,6 +37,7 @@ protected:
|
|||||||
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 suffixImpl();
|
static std::string suffixImpl();
|
||||||
|
static bool setSearchPathImpl(const std::string& path);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string _path;
|
std::string _path;
|
||||||
|
@ -36,6 +36,7 @@ protected:
|
|||||||
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 suffixImpl();
|
static std::string suffixImpl();
|
||||||
|
static bool setSearchPathImpl(const std::string& path);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string _path;
|
std::string _path;
|
||||||
|
@ -36,6 +36,7 @@ protected:
|
|||||||
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 suffixImpl();
|
static std::string suffixImpl();
|
||||||
|
static bool setSearchPathImpl(const std::string& path);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string _path;
|
std::string _path;
|
||||||
|
@ -106,4 +106,10 @@ std::string SharedLibrary::suffix()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool SharedLibrary::setSearchPath(const std::string& path)
|
||||||
|
{
|
||||||
|
return setSearchPathImpl(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} // namespace Poco
|
} // namespace Poco
|
||||||
|
@ -91,4 +91,10 @@ std::string SharedLibraryImpl::suffixImpl()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool SharedLibraryImpl::setSearchPathImpl(const std::string&)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} // namespace Poco
|
} // namespace Poco
|
||||||
|
@ -127,4 +127,10 @@ std::string SharedLibraryImpl::suffixImpl()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool SharedLibraryImpl::setSearchPathImpl(const std::string&)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} // namespace Poco
|
} // namespace Poco
|
||||||
|
@ -132,4 +132,10 @@ std::string SharedLibraryImpl::suffixImpl()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool SharedLibraryImpl::setSearchPathImpl(const std::string&)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} // namespace Poco
|
} // namespace Poco
|
||||||
|
@ -95,4 +95,14 @@ std::string SharedLibraryImpl::suffixImpl()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool SharedLibraryImpl::setSearchPathImpl(const std::string& path)
|
||||||
|
{
|
||||||
|
#if _WIN32_WINNT >= 0x0502
|
||||||
|
return SetDllDirectoryA(path.c_str()) != 0;
|
||||||
|
#else
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} // namespace Poco
|
} // namespace Poco
|
||||||
|
@ -106,4 +106,16 @@ std::string SharedLibraryImpl::suffixImpl()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool SharedLibraryImpl::setSearchPathImpl(const std::string& path)
|
||||||
|
{
|
||||||
|
#if _WIN32_WINNT >= 0x0502
|
||||||
|
std::wstring wpath;
|
||||||
|
Poco::UnicodeConverter::toUTF16(path, wpath);
|
||||||
|
return SetDllDirectoryW(wpath.c_str()) != 0;
|
||||||
|
#else
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} // namespace Poco
|
} // namespace Poco
|
||||||
|
Loading…
Reference in New Issue
Block a user