I'm trying to build the Miranda IM instant messaging client from the source code that I downloaded from the SVN repository (I'm building version 0.8.0 since later versions broke support for the BClist plugin, which I want to use since I'm a visually impaired user who uses a screen reader) under MS VS 2008 Pro, however, when I try to build the solution, I get this error:
.\msn_misc.cpp(57) : error C2440: 'TypeCast': Cannot convert from 'overloaded-function' to 'pIncrementFunc(__stdcall *)'
None of the functions with this name in scope match the target type
What causes this error, and how can I resolve it so that I can perform the build successfully? I'm trying to build the Release version, and when I build with the Debug build configuration, I don't get the error. What's with that?
How much of the code? The original .cpp file is 39 KB in size, and wouldn't fit in this amount of space (8192 chars). But I'll post the first couple functions, as well as a few of the global definitions at the beginning of the file, as that might help.
typedef LONG ( WINAPI pIncrementFunc )( PLONG );
static pIncrementFunc MyInterlockedIncrement95;
static pIncrementFunc MyInterlockedIncrementInit;
pIncrementFunc *MyInterlockedIncrement = MyInterlockedIncrementInit;
static CRITICAL_SECTION csInterlocked95;
/////////////////////////////////////////////////////////////////////////////////////////
// InterlockedIncrement emulation
static LONG WINAPI MyInterlockedIncrement95(PLONG pVal)
{
DWORD ret;
EnterCriticalSection(&csInterlocked95);
ret=++*pVal;
LeaveCriticalSection(&csInterlocked95);
return ret;
}
//there's a possible hole here if too many people call this at the same time, but that doesn't happen
static LONG WINAPI MyInterlockedIncrementInit(PLONG pVal)
{
DWORD ver = GetVersion();
if (( ver & 0x80000000 ) && LOWORD( ver ) == 0x0004 )
{
InitializeCriticalSection( &csInterlocked95 );
MyInterlockedIncrement = MyInterlockedIncrement95;
}
else
MyInterlockedIncrement = (pIncrementFunc*)InterlockedIncrement;
return MyInterlockedIncrement( pVal );
}
I know that that doesn't correspond to the exact line numbers in the original file, but hopefully it'll give you an idea of what's going on and where the error occurs.