iw4x-client/src/Utils/Library.cpp
momo5502 82e9f3864c [General] Refactor all the code
This is the actual refactoring, the last commit was broken
2017-01-20 22:41:03 +01:00

30 lines
494 B
C++

#include "STDInclude.hpp"
namespace Utils
{
Library::Library(std::string buffer, bool _freeOnDestroy) : module(nullptr), freeOnDestroy(_freeOnDestroy)
{
this->module = LoadLibraryExA(buffer.data(), nullptr, 0);
}
Library::~Library()
{
if (this->freeOnDestroy && this->valid())
{
FreeLibrary(this->getModule());
}
this->module = nullptr;
}
bool Library::valid()
{
return (this->getModule() != nullptr);
}
HMODULE Library::getModule()
{
return this->module;
}
}