0

I'm developing a software which uses QSslSocket to establish secured connections with a remote server. All DLL's I use (including Qt's precompiled DLLs) are stored into "DLL" subfolder. I planned to put "libeay32.dll" and "ssleay32.dll" into that DLL subfolder. Therefore, I copied the files and updated my manifest file accordingly.

<file name="libeay32.dll"/>
<file name="ssleay32.dll"/>

For some reason I can't explain, my application still finds "libeay32.dll" and "ssleay32.dll" somewhere else, and won't work because those are the wrong version.

If I put those DLL directly into the application directory, it works, but that's not what I want to do.

EDIT: For some reason, it works for others DLL (for instance OpenCV that I use as well).

EDIT2: This is NOT duplicate with the topic @rubenvb mentioned, it is actually a bug that has been reported to Qt: https://bugreports.qt.io/browse/QTBUG-59071

How can I tell Qt to take those DLL from the folder I expect?

NonoxX
  • 134
  • 10
  • Duplicate is not applicable here. I edited to mention that, but the DLL subfolder already exists, with a DLL.manifest file into it. It already contains quite a few DLLs, which are for sure loaded from this place (if I rename them, I get SxS error). – NonoxX May 14 '18 at 13:58
  • I found what I was looking for. Qt loads OpenSSL through QSystemLibrary::load, which mimics Windows' behavior regarding DLL load sequence BUT doesn't take any Manifest into account. See here: https://code.woboq.org/qt5/qtbase/src/corelib/plugin/qsystemlibrary.cpp.html – NonoxX May 14 '18 at 15:14
  • 1
    @user3606329 Finally found that it is a known Qt bug https://bugreports.qt.io/browse/QTBUG-59071 I'd like to elaborate a clean answer for this question, but it's impossible, as "duplicate"... – NonoxX May 14 '18 at 15:32

1 Answers1

0

You will need to add your DLL subdir to the dll search path that windows uses. You can achieve this using SetDllDirectory, which specifies a custom directory that windows searches for dlls.

If you had multiple directories containing the DLLs, you'd use AddDllDirectory instead.

xslr
  • 350
  • 5
  • 12
  • It won't work, as those DLL are already loaded when entering the main function, thus at the point I can call SetDllDirectory. – NonoxX May 14 '18 at 12:01