I’m compiling a program on gcc by using -Wbad-function-cast flag. The gcc show the following warning:
cast does not match function type
this is line of warning: int ret = (int)FindExecutable(file, NULL, result)
The question is: it’s possible remove it? maybe casting to another windows data type, but that I handling it as an integer.
Have you looked to see what HINSTANCE actually is? (I’m guessing its a pointer, not an int). So you will probably have better luck casting to a void*
http://msdn.microsoft.com/en-us/library/windows/desktop/aa383751(v=vs.85).aspx
A handle to an instance. This is the base address of the module in memory.
HMODULE and HINSTANCE are the same today, but represented different things in 16-bit Windows.
This type is declared in WinDef.h as follows:
typedef HANDLE HINSTANCE;
HANDLE
A handle to an object.
This type is declared in WinNT.h as follows:
typedef PVOID HANDLE;
A pointer to any type.
This type is declared in WinNT.h as follows:
typedef void *PVOID;