Conflicting types interchanging void * and HINSTANCE

Viewed 200

For my win32 code, I want to do without windows typedefs. Perusing Windows Data Types shows HINSTANCE to be a void *. As I know MSDN can get out of date, inspecting shared\wtypes.h inside of Windows 10 SDK reveals typedef void *HINSTANCE.

Compiling the following fails, returning error: conflicting types in WinMain:

int __stdcall
WinMain(void *instance, void *prev_instance, char *cmd_line , int cmd_show)
{
  return 0;
}

I compile with clang++ and windows headers.

Changing the void * to HINSTANCE of course fixes the issue. However, why is this the case?

1 Answers

Not sure how did you find that definition. I have:

DECLARE_HANDLE(HINSTANCE);

where

#define DECLARE_HANDLE(name) struct name##__{int unused;}; typedef struct name##__ *name

Re: @chriscomment - interesting! Without STRICT I can build fine with void* instead of HINSTANCE.

Related