Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-interfaces by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group