0

I created an app that encrypt decript using OpenSSL.

To compile/link it in g++ needed to include static libs:

g++ -o gssag agent_main.cpp libssl.a libcrypto.a -ldl -std=c++14

this "dl" library seems to be a library to load dinamic libraries that LINUX need.

I dont undersand why need them if using *.a static libraries. But without this ld library nothing works.

But In Windows using openssl and crypto *.libs g++ linkeditor also ask for dlopen functions.

What I use in Windows to substitute the linux dl library???

tadman
  • 208,517
  • 23
  • 234
  • 262
Neumann
  • 319
  • 2
  • 14
  • 1
    `-ldl` loads the [`libdl` library](https://www.unix.com/man-page/all/3LIB/libdl/) though I'm not sure that's what you're looking for here. The documentation implies it's been moved to `libc` which means this stub is no longer relevant. – tadman Jan 16 '18 at 17:24
  • 1
    If you're asking for the Windows equivalent, MSDN has you covered: [`LoadLibrary`](https://msdn.microsoft.com/en-us/library/windows/desktop/ms684175%28v=vs.85%29.aspx). – tadman Jan 16 '18 at 17:26

1 Answers1

2

You would need to get a windows openssl dll and use the LoadLibrary function instead of dlopen.

HINSTANCE hDllInstance = LoadLibrary(_T("MyDll.dll"));
if(!hDllInstance)
{ /* dll failed to load */ }
tadman
  • 208,517
  • 23
  • 234
  • 262
SoronelHaetir
  • 14,104
  • 1
  • 12
  • 23
  • I am not using dlopen. The linkeditor advise that need dlopen function when I try to link OpenSSL and Crypto static libraries. Then I suppose this libraries need dlopen function. But in Windows which library give this functions??? – Neumann Jan 16 '18 at 17:41
  • `dlopen` does not exist on Windows. [`LoadLibrary`](https://msdn.microsoft.com/en-us/library/windows/desktop/ms684175%28v=vs.85%29.aspx) is a distant equivalent, but [dynamic loading](https://en.wikipedia.org/wiki/Dynamic_loading) is *really different* on Windows & on Linux. Read [*Linkers & Loaders*](http://iecc.com/linkers/) to understand the details – Basile Starynkevitch Jan 16 '18 at 17:54