0

I'm building a dll to use PocoNetSSL to get some data via an HTTPS endpoint. I need to call that dll via C# in Unity which runs an old version of Mono.

I am using mingw-w64 shell to build my dll. There is a package of the Poco libraries available via the package manager pacman and I am using that.

$ pacman -Qs 'poco'
local/mingw-w64-x86_64-poco 1.6.0-2
    POrtable COmponents C++ Libraries (mingw-w64)

I can build an executable and it builds fine & runs fine hitting the https endpoint. I have openssl installed somewhere or it may have come with mingw.

My problem is that I cannot open the dll with LoadLibrary. I get a null pointer and I'm guessing it's a dependency problem. Here's my build commands and a snapshot of dependency walker. Is there anything I am missing here. I think I should be able to do this but maybe not?

sburke@sburke-pc MINGW64 ~/sandbox/hitaws
$ scons
scons: Reading SConscript files ...
msys
scons: done reading SConscript files.
scons: Building targets ...
g++ -o gdoaws.os -c -Wall -DPOCO_WIN32_UTF8 -I/mingw64/include gdoaws.cpp
g++ -o gdoaws.dll -Wl,-no-undefined -shared -Wl,--out-implib=libgdoaws.dll.a -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--whole-archive gdoaws.os -Wl,--no-whole-archive -L/mingw64/lib -lPocoNetSSL.dll -lPocoNet.dll -lPocoUtil.dll -lPocoFoundation.dll
scons: done building targets.

enter image description here

doqtor
  • 8,414
  • 2
  • 20
  • 36
Stephen Burke
  • 882
  • 3
  • 10
  • 25

1 Answers1

0

Assuming your loading a dynamic library code is correct your app is very likely trying to load different version of openssl dlls than Poco was built against.

In msys2 you can check a dynamic library dependencies by:

ldd /mingw64/bin/libPocoNetSSL.dll

which depends on:

LIBEAY32.dll => /mingw64/bin/LIBEAY32.dll 
SSLEAY32.dll => /mingw64/bin/SSLEAY32.dll

Is this what you see in dependency walker?

The best workround for this problem is to copy above dlls to the folder where your executable is and always distribute them with your software.

doqtor
  • 8,414
  • 2
  • 20
  • 36