Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Included OpenSSL as a static library, but it's still looking for a DLL?

I installed OpenSSL 1.0.0 on Windows using the installer available at: http://www.slproweb.com/products/Win32OpenSSL.html

I added the .lib files to my project (this is Visual Studio, added it to Project Settings->Linker->Input), and it compiles and works fine. But when I remove the OpenSSL DLL files in Windows\system32, it complains that

"Debugger:: An unhandled non-continuable STATUS_DLL_NOT_FOUND exception was thrown during process load"

Any idea why it's still looking for the DLL even when it's compiled with the static libs? I'm not referencing the DLLs anywhere in the project. The static libs I included are libeay32.lib and ssleay32.lib.

Thanks, -M

like image 550
mindthief Avatar asked Nov 02 '10 00:11

mindthief


2 Answers

use libeay32MT.lib file that have almost 19 mb size as your library. because it is a static library but libeay32.lib is a library for using the dll.

like image 59
ms vt Avatar answered Sep 23 '22 20:09

ms vt


It's looking for the DLLs because the code is loaded dynamically at runtime. The code in the static libraries is just a set of stub functions which call into the DLL -- compare the sizes of the .lib and .dll files, and I bet you'll see that the DLLs are much larger, since that's where the bulk of the actual encryption code lies.

Hence, as you found out, you should not delete the DLLs. In order to distribute your program properly, you'll also need to distribute those DLLs with it in order for it to work correctly. However, keep in mind that there are legal issues with doing this, since there are US export restrictions on certain encryption code. So be extra careful in redistributing those DLLs -- make extra sure what you're doing is legal.

like image 21
Adam Rosenfield Avatar answered Sep 22 '22 20:09

Adam Rosenfield