tags:

views:

80

answers:

1

Hi,

Dll best practices document from Microsoft available Here recommends avoiding use of memory management function from the dynamic C Run-Time (CRT) within DllMain. But DllMain function of MFC Extension DLL is dynamically allocating the memory for CDynLinkLibrary in the code snippet available at MSDN "http://msdn.microsoft.com/en-us/library/1btd5ea3%28v=VS.80%29.aspx".

Is it a violation of Dll Best Practices or ok to use in MFC extension DLL?

thanks

A: 

"Because the MFCx0.dll is fully initialized by the time DllMain is called, you can allocate memory and call MFC functions within DllMain (unlike the 16-bit version of MFC)."

Windows programmer
Thanks for reply. Can you please tell whether or not initialization of MFCx0.dll means initialization of Dynamic CRT library?
Picaro De Vosio
I think each version of the MFC library depends on the corresponding version of the CRT library so the CRT had to be initialized before MFC.
Windows programmer