Newer
Older
#include "MantidKernel/LibraryWrapper.h"
namespace Mantid
{
namespace Kernel
{
/// Constructor
LibraryWrapper::LibraryWrapper() :
Gigg, Martyn Anthony
committed
module(0)
{}
/// Destructor
LibraryWrapper::~LibraryWrapper()
{
Gigg, Martyn Anthony
committed
//Close lib
if (module)
{
DllOpen::CloseDll(module);
module = 0;
}
Janik Zikovsky
committed
* @param libName :: The name of the file to open (not including the lib/so/dll).
* @return True if DLL is opened or already open.
*/
bool LibraryWrapper::OpenLibrary(const std::string& libName)
{
Gigg, Martyn Anthony
committed
if (!module)
{
//Load dynamically loaded library
module = DllOpen::OpenDll(libName);
if (!module)
{
return false;
}
}
Gigg, Martyn Anthony
committed
return true;
}
/** Opens a DLL.
Janik Zikovsky
committed
* @param libName :: The name of the file to open (not including the lib/so/dll).
* @param filePath :: The filepath to the directory where the library is.
* @return True if DLL is opened or already open
*/
bool LibraryWrapper::OpenLibrary(const std::string& libName,
Gigg, Martyn Anthony
committed
const std::string& filePath)
Gigg, Martyn Anthony
committed
if (!module)
{
//Load dynamically loaded library
module = DllOpen::OpenDll(libName, filePath);
if (!module)
{
return false;
}
}
Gigg, Martyn Anthony
committed
return true;
} // namespace Kernel
} // namespace Mantid