Skip to content
Snippets Groups Projects
LibraryWrapper.cpp 1.18 KiB
Newer Older
#include "MantidKernel/DllOpen.h"
#include "MantidKernel/LibraryWrapper.h"

namespace Mantid
{
namespace Kernel
{

/// Constructor
LibraryWrapper::LibraryWrapper() :
	module(0)
{}

/// Destructor
LibraryWrapper::~LibraryWrapper()
{
	//Close lib
	if (module)
		DllOpen::CloseDll(module);
		module = 0;
/** Opens a DLL.
 *  \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)
{
Matt Clarke's avatar
Matt Clarke committed
	if (!module)
		//Load dynamically loaded library
		module = DllOpen::OpenDll(libName);
		
		if (!module)

	return true;
}

/** Opens a DLL.
 *  \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,
		const std::string& filePath)
{
Matt Clarke's avatar
Matt Clarke committed
	if (!module)
		//Load dynamically loaded library
		module = DllOpen::OpenDll(libName, filePath);
		if (!module)
} // namespace Kernel
} // namespace Mantid