In xp 32bit this line compiles with not problem however in vista 64bit this line:
m_FuncAddr = ::GetProcAddress (somthing);
gives the following error
> error C2440: '=' : cannot convert from
> 'FARPROC' to 'int (__cdecl *)(void)'
GetProcAddress is defined as
WINBASEAPI FARPROC WINAPI GetProcAddress (somthing)
And m_FuncAddr as
int (WINAPI *m_FuncAddr)();
From what I understand both are stdcall's.
To avoid the error I had to put
m_FuncAddr = (int (__cdecl *)(void))::GetProcAddress(somthing);
If both m_FuncAddr and GetProcAddress have the stdcall calling convention why do I have to 'recall' it with cdecl ?
Is it possible that the VS project setting 'default calling convention (which is set to cdecl) over-rides the assignemet statment above ?
Thanks in advance!
To clerfiy the question:
On one side of the equation (say side 1) i have
int __stdcall * m_FuncAddr
On other side (side 2)
INT_PTR far __stdcall GetProcAddress
So how is it that i have to cast side 2 with cdecl if both are stdcalls ?
Or am I not getting something ? My answer still stands after your edit, int and INT_PTR are very different in 64-bit builds!
以上就是stdcall over-ride by visual studio?的详细内容，更多请关注web前端其它相关文章！