Developer forums (C::B DEVELOPMENT STRICTLY!) > Development

Windows DLL Template is wrong

(1/1)

ninja9578:
The template with 8.02 declares DLLMain incorrectly.

in the template, DLLMain's 2nd argument is a DWORD, but Windows expects it to be a WORD.  I was wondering why the entry point was never getting called.  Hopefully this will be fixed in the next iteration :)

stahta01:
Please report problem to Microsoft.
After they fix their documentation; then I will agree with you.
I have no idea what is correct; but, I think microsoft docs is likely right.

From http://msdn.microsoft.com/en-us/library/ms682583%28VS.85%29.aspx

--- Code: ---BOOL WINAPI DllMain(
  __in  HINSTANCE hinstDLL,
  __in  DWORD fdwReason,
  __in  LPVOID lpvReserved
);

--- End code ---

Tim S.

ninja9578:
MSDN is full of incorrect information.  This is one of those cases, you can try the code if you'd like, make a dll from the template, put some debug in the DllMain, and load the library dynamically, it will never get called the way that it is.  I'm reporting it to microsoft now.

Sowaco:
Take a short look into MFC-Implementation:

extern "C"
BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID)
....

So,

The template with 8.02 declares DLLMain CORRECTLY.

Regards
  Andreas

Navigation

[0] Message Index

Go to full version