3

In my application (build with Delphi XE8) I use the IdHTTP component. When I tried to run the application, the following exception was thrown: 'Could not load SSL library'. I solved this issue by downloading the OpenSSL library from this site http://thundaxsoftware.blogspot.nl/2014/09/cannot-load-ssl-library-using-delphi-xe7.html If I'm correct: the files 'libeay32.dll' and 'ssleay32.dll' are needed.

But it only works for me. A friend of mine, who also uses this application, got the same error ("Could not load SSL library"). I want others to be able to download my application without them having to download the OpenSSL library seperately. Is it possible to include these two files into my application? For example by adding a folder to the directory location of the application? If so, how can I make the application find these files when it needs them?

I hope you can help me! (My apologies for the bad English)

Teun
  • 579
  • 1
  • 7
  • 14
  • 2
    Are you asking [how to statically link OpenSSL libraries](http://stackoverflow.com/q/19695855/960757), or how to deploy them in a subfolder relative to your application binary ? Simply adding them to the same folder as your application is enough (and in many cases the best choice). – TLama Aug 21 '15 at 14:21
  • 1
    Static linking of these libraries is a bad idea, if indeed it is even possible. SImply deploy the DLLs alongside your executable. – David Heffernan Aug 21 '15 at 14:22
  • @TLama I would like to know how I can link these .dll files with my application so that the IdTHHP component can access these files. I would like this to be done in such a way, that I can send the application to someone else and that the application is still linked with these files. I hope you can understand what I mean.. – Teun Aug 21 '15 at 14:41
  • @David Heffernan: How can I make my application find these files if I deploy the DLLs alongside my executable? Do I have to add a library path or something? – Teun Aug 21 '15 at 14:43
  • No, that's the first place that will be searched. The DLL search path begins in the executable directory. Of course, I'm assuming that Indy will respect the DLL search path but I'm pretty sure that, if you don't tell it where to look, the DLL search path is all that it can try. – David Heffernan Aug 21 '15 at 14:46
  • @DavidHeffernan: Yes, Indy uses the system's DLL search path by default when loading various DLLs including OpenSSL. However, in the case of OpenSSL specifically, Indy also has an `IdOpenSSLSetLibPath()` function to tell Indy which folder to load the OpenSSL DLLs from, if needed. – Remy Lebeau Aug 21 '15 at 18:18

2 Answers2

4

You should bundle the DLLs (and any other necessary files) with your application in an installer. The installer can then install the DLLs in the same folder as your application executable, and your app will be able to find them when it's run. It also makes it much easier for your users to get the files into the proper locations by simply running Setup.exe (or YourAppSetup.exe).

There are several products that will create the installer for you, including the free (written in Delphi) Inno Setup.

Ken White
  • 123,280
  • 14
  • 225
  • 444
0

The cleanest way to handle this is to deploy the SSL DLLs to the same directory as your executable file.

Assuming that you do not specify a location for the libraries, Indy will default to using the system DLL search order. And the executable file's directory is the top of that search order. So your DLL files will be found.

By supplying these libraries your app is isolated from other applications. That avoids so-called DLL hell where multiple applications share libraries but all have different version requirements.

Community
  • 1
  • 1
David Heffernan
  • 601,492
  • 42
  • 1,072
  • 1,490