This typedef:
typedef DWORD WINAPI
(* CM_Open_DevNode_Key)(DWORD, DWORD, DWORD, DWORD, PHKEY, DWORD);
compiles fine in BorlandCpp, however, when I compile it in msvc I have to remove WINAPI
(which is just an alias for __stdcall
):
typedef DWORD
(* CM_Open_DevNode_Key)(DWORD, DWORD, DWORD, DWORD, PHKEY, DWORD);
Why is this happening? Can I remove the WINAPI part safely?
Update: I had to remove "WINAPI" form the typedef, otherwise I got
error C2059: syntax error : '('
for the line.
Can you tell me why Borland could compile it with "WINAPI" while Msvc couldn't?
I believe on VC++ you need to put the calling convention inside the ()'s Here's an example on MSDN of using a calling convention inside a function pointer typedef.
typedef DWORD (WINAPI * CM_Open_DevNode_Key)(DWORD, DWORD, DWORD, DWORD, PHKEY, DWORD);
This should compile without problem.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With