[PATCH 0/4] dlopen: improving the search algorithm

Michael Haubenwallner michael.haubenwallner@ssi-schaefer.com
Wed Aug 31 18:07:00 GMT 2016

Hi Corinna,

based on the discussion on -developers list [1][2], here's a reworked
set of patches for dlopen, split along these features and fixes.

[1] https://cygwin.com/ml/cygwin-developers/2016-06/msg00000.html
[2] https://cygwin.com/ml/cygwin-developers/2016-08/msg00000.html

*) Switch to pathfinder class for path search iteration, without any
deliberate change in behaviour, but with the pathfinder::criterion
interface to allow for more generic use eventually.

*) Fix search order to search all basenames per one directory
rather than searching all directories per one basename.

*) For dlopen ("/path/lib/libz.so"), search "/path/bin/" first when
the executable calling is located in "/path/bin/".  This is for [3].
[3] https://cygwin.com/ml/cygwin-developers/2016-08/msg00020.html

*) Consequently, dlopen ("libAPP.so") without an explicit path
should search the executable's directory first, like the Windows
loader does for linked dlls.

Topics dropped for now:

*) Extra GetModuleHandleEx is not that necessary to me, as it[4]
turns out that LoadLibrary detects a dll as already loaded even
if the underlying dll file has been replaced (renamed actually).
[4] https://cygwin.com/ml/cygwin-developers/2016-08/msg00023.html

*) Add PATH environment variable to list of searchdirs should not
be necessary to me when the executable dir is added.

Thank you!

More information about the Cygwin-patches mailing list