|
///////////////////////////////////////////////////////////////////////////////
//
// CDynDll
// ----------
// wrapper base class for a dynamically loaded DLL
//
////Holger Kloos, 1999-2001////////////////////////////////////////////////////
#include "stdafx.h"
#include "DynDLL.h"
// CDynDLL
// -------
typedef int (*FGetVersion)(void);
// CDynDll
// -------
CDynDLL::CDynDLL()
{
m_hInst = 0;
}
CDynDLL::~CDynDLL()
{
Free();
}
BOOL CDynDLL::Create(LPCTSTR pName)
{
m_hInst = LoadLibrary(pName);
if (!m_hInst)
TRACE("!!! ERROR loading DLL %s!\n", pName);
return m_hInst != NULL;
}
BOOL CDynDLL::Free()
{
BOOL bRes = m_hInst && FreeLibrary(m_hInst);
m_hInst = NULL;
return bRes;
}
BOOL CDynDLL::GetAdress(LPVOID* fct, LPCTSTR name) const
{
ASSERT(m_hInst);
*fct = GetProcAddress(m_hInst, name);
if (!*fct)
TRACE("! Function not found in DLL: %s",name);
return *fct != NULL;
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.