DLL function loading issue
- From: --== Alain ==-- <nospam@xxxxxxxxxxx>
- Date: Sat, 30 Sep 2006 19:14:20 +0200
Hi,
I have an issue with loading a function from my DLL.
here is the DLL *.cpp file :
extern "C" __declspec(dllexport) LPTSTR GetString(int Index)
{
LPTSTR res="";
LoadString(GetModuleHandle(NULL),Index, res, sizeof(res));
return(_T(res));
}
here is my class which should load the DLL and open the function :
*.cpp file :
HINSTANCE CARDLLWrapper::InitializeLoc(CString DLLName)
{
m_hlibLoc=LoadLibrary(DLLName);
if (m_hlibLoc != NULL)
{
LocGetString = (LPTSTR)GetProcAddress(m_hlibLoc, TEXT("GetString"));
return m_hlibLoc;
}
else
{
return 0;
}
}
/------------------
*.h file
class CARDLLWrapper
{
private:
static LPTSTR (*LocGetString)(long);
static HINSTANCE m_hlibLoc;
CString GetResStr(long Index);
public:
HINSTANCE InitializeLoc(CString DLLName);
void TerminateLoc();
CString STR(long);
};
when i try to compile my class CARDLLWrapper, VC tells me :
cannot convert from 'LPTSTR' to 'LPTSTR (__cdecl *)(long)'
now, i'm confused... i'm turning around and around without seeing what is wrong :-(
a little help would be fantastic.
thx.
Al.
.
- Follow-Ups:
- Re: DLL function loading issue
- From: Igor Tandetnik
- Re: DLL function loading issue
- From: Alex Blekhman
- Re: DLL function loading issue
- From: Abdo Haji-Ali
- Re: DLL function loading issue
- Prev by Date: Re: how to get function name in DLL
- Next by Date: Re: DLL function loading issue
- Previous by thread: how to get function name in DLL
- Next by thread: Re: DLL function loading issue
- Index(es):
Relevant Pages
|