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


On Jun  1 08:40, Michael Haubenwallner wrote:
> Hi,
> 
> two issues with dlopen here (I'm about to prepare patches):
> 
> *) The algorithm to combine dll file name variants with the search path
>    entries needs to be reordered, as in:
>    - for each dll file name variant:
>    -   for each search path:
>    + for each search path entry:
>    +   for each dll file name variant:
>          check if useable

Rationale?  We only need to find one version of the file and there
usually only is one.  This is mainly for moduled systems like perl,
python, etc.  However, if you can speed up the search process ignore the
question...

> *) The directory of the current main executable should be searched
>    after LD_LIBRARY_PATH and before /usr/bin:/usr/lib.
>    And PATH should be searched before /usr/bin:/usr/lib as well.

Checking the executable path and $PATH are Windows concepts.  dlopen
doesn't do that on POSIX systems and we're not doing that either.

Having said that, LoadLibrary will search the usual paths.  After 2.5.2,
we're leaving XP/2003 behind, and then we probably should tighten the
search algorithm along the lines of

  AddDllDirectory ("/usr/bin");
  AddDllDirectory ("/usr/lib");
  [...]
  LoadLibraryEx (path, NULL, LOAD_LIBRARY_SEARCH_USER_DIRS
			     | LOAD_LIBRARY_SEARCH_SYSTEM32);

>    For consistency, IMO, when any searched path ends in either
>    x/bin or x/lib, we should search x/bin:x/lib.

This might make sense, at least in the direction lib->bin.


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]