Re: Can a windows DLL have more than one process attached?

From: "Ross J(dot) Reedstrom" <reedstrm(at)rice(dot)edu>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-interfaces(at)postgresql(dot)org
Subject: Re: Can a windows DLL have more than one process attached?
Date: 2001-11-27 19:26:09
Message-ID: 20011127132609.A10113@rice.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

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

In response to

Responses

Browse pgsql-interfaces by date

  From Date Subject
Next Message Tom Lane 2001-11-27 19:29:13 Re: Can a windows DLL have more than one process attached?
Previous Message Ross J. Reedstrom 2001-11-27 19:01:47 Re: Can a windows DLL have more than one process attached?