Code::Blocks
July 29, 2010, 05:56:46 pm *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: New release 10.05 is ready. Grab it while it's hot!!!
 
   Home   Help Search Login Register  :: WebsiteWiki  
Pages: [1]
  Send this topic  |  Print  
Author Topic: Windows DLL Template is wrong  (Read 564 times)
ninja9578
Newcomer
*
Posts: 9


« on: March 11, 2010, 12:27:13 am »

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 Smile
Logged
stahta01
Lives here!
****
Posts: 2379


WWW
« Reply #1 on: March 11, 2010, 12:34:24 am »

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
);

Tim S.
« Last Edit: March 11, 2010, 01:06:42 am by stahta01 » Logged

C Programmer working to learn more about C++.
OS: Win 6.1 AKA Win7
Compiler: mingw gcc 4.4 API 3.13 Runtime 3.15.2
IDE: Code::Blocks SVN + patches
wxMSW: SVN 2.9 Trunk & SVN 2.8 branch
SVN: 1.6.x
ninja9578
Newcomer
*
Posts: 9


« Reply #2 on: April 16, 2010, 08:22:39 pm »

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.
« Last Edit: April 16, 2010, 08:24:42 pm by ninja9578 » Logged
Sowaco
Newcomer
*
Posts: 2


« Reply #3 on: April 17, 2010, 11:28:40 am »

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
Logged
Pages: [1]
  Send this topic  |  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!