32 #include <boost/filesystem.hpp>
60 explicit WSharedLib( boost::filesystem::path lib );
101 template <
typename FuncType >
102 void fetchFunction(
const std::string& name, FuncType& func )
const;
122 template <
typename PtrType >
123 void fetchVariable(
const std::string& name, PtrType& variable )
const;
187 template <
typename FuncType >
190 func =
reinterpret_cast< FuncType
>(
findFunction( name ) );
193 template <
typename PtrType >
196 variable =
static_cast< PtrType
>(
findVariable( name ) );
199 #endif // WSHAREDLIB_H
void * findVariable(const std::string &name) const
Find the specified symbol in the library.
static std::string getSystemSuffix()
Returns the suffix for libraries used on the system.
void(* func_ptr_type)(void)
neutral function pointer type
void fetchVariable(const std::string &name, PtrType &variable) const
Search for an variable in the shared library.
std::string getLibraryName()
Returns the filename of the library without path.
static std::string getSystemPrefix()
Returns the prefix used for libraries on the system.
void fetchFunction(const std::string &name, FuncType &func) const
Search for a function in the shared library.
static std::string getSystemLibPath()
Returns the default path for libraries on the current system.
WSharedLib & operator=(const WSharedLib &rhs)
Copy assignment for shared libraries.
func_ptr_type findFunction(const std::string &name) const
Find the specified function pointer in the library.
bool existsFunction(const std::string &name) const
Check whether the function exists.
boost::filesystem::path m_libPath
path to lib
Simple class holding an opened library.
friend void swap(WSharedLib &lhs, WSharedLib &rhs)
Swap to shared libraries.
WSharedLib(boost::filesystem::path lib)
Constructor.
data * m_data
internal data
This class loads shared libraries and provides function pointers.
virtual ~WSharedLib()
Destructor.