how to loadlibrary in a specific folder in windows 64?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

how to loadlibrary in a specific folder in windows 64?

Dennis
I am using FPC 3.0.4 Lazarus.
I tried to use synapse with ssl and the unit ssl_openssl_lib 's
initialization
    runs InitSSLInterface
    which calls
       SSLLibHandle := LoadLib(DLLSSLName);
       SSLUtilHandle := LoadLib(DLLUtilName);

where the var are defined as
   DLLSSLName: string = 'ssleay32.dll';
   DLLUtilName: string = 'libeay32.dll';

it works well.

However, my program also need to call another dll (library) which comes
with its own set of
ssleay32.dll and libeay32.dll which cannot be used by synapse 's
ssl_openssl_lib.
ssl_openssl_lib can only loadlibrary successfully the binary dll files
from https://indy.fulgan.com/SSL/

These clashing of ssl dll is causing me problems.

I tried to put the 2 sets of dll in 2 folders and call
LoadLibrary('folder1\ssleay32.dll') but  LoadLibrary does not accept any
file path.  If there is a file path in the name, it just fails.

Please help.

Dennis



_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: how to loadlibrary in a specific folder in windows 64?

Marcelo Rocha
try using LoadLibraryEx with the flag LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR

Em sex, 8 de fev de 2019 às 08:26, Dennis <[hidden email]> escreveu:
I am using FPC 3.0.4 Lazarus.
I tried to use synapse with ssl and the unit ssl_openssl_lib 's
initialization
    runs InitSSLInterface
    which calls
       SSLLibHandle := LoadLib(DLLSSLName);
       SSLUtilHandle := LoadLib(DLLUtilName);

where the var are defined as
   DLLSSLName: string = 'ssleay32.dll';
   DLLUtilName: string = 'libeay32.dll';

it works well.

However, my program also need to call another dll (library) which comes
with its own set of
ssleay32.dll and libeay32.dll which cannot be used by synapse 's
ssl_openssl_lib.
ssl_openssl_lib can only loadlibrary successfully the binary dll files
from https://indy.fulgan.com/SSL/

These clashing of ssl dll is causing me problems.

I tried to put the 2 sets of dll in 2 folders and call
LoadLibrary('folder1\ssleay32.dll') but  LoadLibrary does not accept any
file path.  If there is a file path in the name, it just fails.

Please help.

Dennis



_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal