0

我正在构建一个 dll 以使用 PocoNetSSL 通过 HTTPS 端点获取一些数据。我需要在运行旧版本 Mono 的 Unity 中通过 C# 调用该 dll。

我正在使用 mingw-w64 shell 来构建我的 dll。通过包管理器 pacman 提供了一个 Poco 库包,我正在使用它。

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

我可以构建一个可执行文件,它构建良好并且运行良好,可以访问 https 端点。我在某处安装了 openssl,或者它可能随 mingw 一起提供。

我的问题是我无法使用 LoadLibrary 打开 dll。我得到一个空指针,我猜这是一个依赖问题。这是我的构建命令和依赖walker 的快照。有什么我在这里想念的吗。我想我应该能够做到这一点,但也许不能?

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.

在此处输入图像描述

4

1 回答 1

0

假设您加载的动态库代码是正确的,您的应用很可能会尝试加载与构建时不同的openssldll版本。Poco

您可以通过msys2以下方式检查动态库依赖项:

ldd /mingw64/bin/libPocoNetSSL.dll

这取决于:

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

这是您在依赖步行者中看到的吗?

解决此问题的最佳解决方法是将上述 dll 复制到可执行文件所在的文件夹,并始终将它们与您的软件一起分发。

于 2015-11-15T12:08:25.043 回答