This is the mail archive of the cygwin-developers mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: About the dll search algorithm of dlopen (patch-r3)


On Aug 30 17:56, Michael Haubenwallner wrote:
> Hi Corinna,
> 
> On 08/30/2016 04:51 PM, Corinna Vinschen wrote:
> > On Aug 29 18:50, Michael Haubenwallner wrote:
> >> On 08/26/2016 01:49 PM, Corinna Vinschen wrote:
> >>> On Aug 26 13:18, Corinna Vinschen wrote:
> >>>
> >>> Apart from these minor bits and pieces, I really like this new
> >>> pathfinder class, btw.
> >>
> >> Thank you! :)
> >>
> >> While at it: Combining dlopen thoughts with the "forkables" background
> >> around replacing dlls-in-use leads me to this thought for redundant
> >> calls of dlopen:
> >>
> >> As we've already agreed that GetModuleHandleEx might make sense,
> > 
> > Erm... where exactly did we do that?  I recall I mentioned using
> > LoadLibraryEx with LOAD_LIBRARY_SEARCH_USER_DIRS and the AddDllDirectory
> > functions, but I don't think we talked about GetModuleHandleEx.
> 
> Indeed not for dlopen calls including a path - but for without a path:
> https://sourceware.org/ml/cygwin-developers/2016-06/msg00003.html
> 
> > The question is if it really makes sense to add calls to
> > GetModuleHandleEx.  Apart from slowing down the dlopen call, it seems
> > unnecessary.  Assuming you call LoadLibrary with the same paths and same
> > extensions in the same order, wouldn't a second call to dlopen have the
> > exact same result (loading the same file)?
> 
> Sure - as long as an already loaded dll is not replaced by an updated one.
> Before I'll gonna try: Do you know by chance what LoadLibrary does here?

No, I don't know exactly, but in theory it should try to match
the incoming filename against the filename stored in the loader
list attached to the PEB.  This would even work if the DLL has been
renamed in the meantime.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

Attachment: signature.asc
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]