On Tue, Nov 27, 2001 at 01:01:47PM -0600, Ross J. Reedstrom wrote:
>
> However, there's another problem. According to the above, and:
>
> http://msdn.microsoft.com/library/en-us/dllproc/dll_4abc.asp?frame=true
>
> It is not safe to call FreeLibrary or LoadLibraryEx from DllMain.
>
> Which points to:
>
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/dll_8asu.asp
>
> Warning On attach, the body of your DLL entry-point function
> should perform only simple initialization tasks, such as
> setting up thread local storage (TLS), creating objects, and
> opening files. You must not call LoadLibrary in the entry-point
> function, because you may create dependency loops in the DLL load
> order. This can result in a DLL being used before the system
> has executed its initialization code. Similarly, you must not
> call the FreeLibrary function in the entry-point function on
> detach, because this can result in a DLL being used after the
> system has executed its termination code.
>
>
> Any real windows coders know if this is a problem?
>
Reading into this further, it seems to me that this code is attempting to
implement DLL dependencies. I'd think that the DLL loader is _supposed_
to handle that automatically (based on te docmuentation for LoadLibrary
mentioning that it can cause dependent libraries to also be loaded), but
I know even less about building win32 dlls than I do about coding them.
Are we mis-building somehow?
The warning above also sounds like the only problem is reference loops.
Ross