Re: function in DLL
In fact i can not return an address of re TCHAR array to the calling
function. it returns every time the first TCHAR only :-(
here is how i call this DLL function :
....
typedef LPTSTR (*FUNCT_LocGetString)(HMODULE, long, LPTSTR); //working
static FUNCT_LocGetString MyGetStr;
static HINSTANCE m_hlibLoc;
m_hlibLoc=LoadLibrary(DLLName);
if (m_hlibLoc != NULL)
{
(FUNCT_LocGetString)MyGetStr =
(FUNCT_LocGetString)GetProcAddress(m_hlibLoc, TEXT("DLL_GetString"));
}
....
MyGetStr(m_hlibLoc, Index);
....
Al.
Abdo Haji-Ali wrote:
"--== Alain ==--" <nospam@noemail.com> wrote in message
news:#Weix5Y5GHA.2288@TK2MSFTNGP05.phx.gbl...
re is already in static and i only use re now..
for information :
in my class DLLwrapper i already use the win32 function like :
LoadLibrary, LoadString, FreeLibrary.
and it works well... but i would like really to make my previous code
working..
here is how it looks like :
extern "C" __declspec(dllexport) LPTSTR DLL_GetString(HMODULE hwnd_DLL,
long Index);
extern "C" __declspec(dllexport) LPTSTR DLL_GetString(HMODULE hwnd_DLL,
long Index)
{
int iError;
static TCHAR re[2048] = {'\0'};
iError = ::LoadString(hwnd_DLL,Index, re, sizeof(re)/sizeof(re[0]));
return(re);
}
even if re is declared as static, it does not help. :-(
Can you just show us how you call this function? Also I assume that when you
say it's not working you mean that it returns an empty string, right?