Dows anyone know how to define the WNDPROC type?
Printable View
Dows anyone know how to define the WNDPROC type?
I define an API function as so:
I get this error:Code:#define WINUSERAPI
#define IN
WINUSERAPI void * __stdcall LoadIcon(IN void *hInstance, IN const unsigned short *lpIconName);
--------------------Configuration: Test - Win32 Debug--------------------
Compiling...
Test.cpp
Linking...
Test.obj : error LNK2001: unresolved external symbol "void * __stdcall LoadIcon(void *,unsigned short const *)" (?LoadIcon@@YGPAXPAXPBG@Z)
Debug/Test.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
Test.exe - 2 error(s), 0 warning(s)
Any Ideas?
This is because a C++ compiler gives the functions other internal names than a C compiler. Write
extern "C" WINUSERAPI void * __stdcall LoadIcon(IN void *hInstance, IN const unsigned short *lpIconName);
This will tell the compiler to use the C naming convention.