Re: GetProcAddress Exception in XP
LoadLibrary() and GetProcAddress() work on XP the same as for 2000.
Potential causes for failure include:
1) LoadLibrary() failed, probably because the DLL file is not where you
expect it to be. Use GetCurrentDirectory() before LoadLibrary() so you can
see in the debugger if the code is executing from where you think it is.
2) The DLL has the same name as another DLL already mapped into the process,
and that DLL does not have the GetMyFunction exported. In the debugger, stop
before LoadLibrary(), and check the list of loaded modules to see if the DLL
name is listed already.
3) The DLL is being rebuilt for XP, and, for some reason, GetMyFunction is
not exported. Use DUMPBIN /exports on your .DLL built for XP and verify
that "GetMyFunction" is listed.
"MSDevelOlap" <MSDevelOlap@discussions.microsoft.com> wrote in message
news:652F7EAD-2DF5-4A0F-80D2-A3C279FAF3A9@microsoft.com...
The following line is where the library is freed in XP, but not 2000:
if (!lpfnDllFunc18)
FreeLibrary(hCustVerCtrlDLL); //THIS IS WHERE IT IS FREEING THE LIB
IN XP
"Igor Tandetnik" wrote:
MSDevelOlap <MSDevelOlap@discussions.microsoft.com> wrote:
I have an application that works in 2000, but is having trouble
linking to a DLL in XP.
Precisely what kind of trouble? What fails, with what error code?
--
With best wishes,
Igor Tandetnik
With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925
I have an application that works in 2000, but is having trouble
linking to a DLL in XP. The code is as follows:
typedef UINT (*LPFNDLLFUNC18)(long,UINT);
LPFNDLLFUNC18 lpfnDllFunc18;
UINT uiReturnVal;
lpfnDllFunc18 = (LPFNDLLFUNC18)GetProcAddres
hCustVerCtrlDLL,"GetMyFunction");
if (!lpfnDllFunc18)
FreeLibrary(hCustVerCtrlDLL); //THIS IS WHERE IT IS FREEING THE LIB
IN XP
else
{
uiReturnVal = lpfnDllFunc18( 0,0);
if ( uiReturnVal == 0 ){
SetLibrary(FALSE);
} else if ( uiReturnVal == 1 ){
SetLibrary(TRUE);
} else {
SetLibrary(FALSE);
}
}
What could be causing the differences in 2000 and XP?
What dependencies are there for the GetProcAddress function?
Any help is appreciated.