Cygwin's sqlite3 modifies DLL search order

E. Madison Bray
Wed Jul 29 11:22:10 GMT 2020

(Oops, resending this upon realizing I didn't reply to the list)

On Fri, Jul 17, 2020, 09:34 Jan Nijtmans  wrote:
> Op do 16 jul. 2020 om 18:48 schreef E. Madison Bray via Cygwin:
> >
> > Hi all,
> >
> > After some significant headache I discovered a problem introduced by
> > the Cygwin patches for sqlite3.  The effect of this patch is that it
> > modifies the DLL search order for all subsequent DLL loads (by
> > filename instead of absolute path) in the application.
> Thanks for bringing this to my attention. I'm open to suggestions how
> to fix this. Yes, this code is already in for a long time. It even contains
> an experimental part (the part within #ifdef _WIN32), when I was
> trying to make a Win32 build of SQLite work in a Cygwin environment,
> oviously a bad idea ......
> Thinking about it, I have an idea how to fix it:  Currently extensions
> (when using the win32 vfs) are loaded using the Win32 function
> LoadLibrary().  Changing that to use dlopen() might already have
> the desired effect, then this section can simply be removed
> completely.
> Thanks!
>        Jan Nijtmans

Hi Jan,

Thanks for commenting on this, and thank you for all the work you've
done maintaining this port!

Yes, the original patch you came up with made sense to me so I was
still a little confused by why the SetDllDirectory stuff was added.
But I'm sure it fixed something at the time.

As long as we're patching it for Cygwin anyways I think your idea to
use dlopen() makes sense. Cygwin's dlopen should do all the path
management properly anyways :)

More information about the Cygwin mailing list