Error opening dll library错误的解决

C/C++/C#/C++Builder

Error opening dll library 这个错误错误,有时出现在非开发电脑上。究其原因,是因为引用的dll还有其他dll的依赖。而在发布时,其他电脑上因为不存在这个所依赖的dll所以提示错误。

有资料说:

DLL is 16 bit and thus incompatible.
DLL is not in a searchable directory.
DLL connects to another DLL that cannot be found.
DLL has the same name as another already loaded into memory.
DLL is corrupted or in an incompatible format.

我封装了一个openssl,用c++builder封装的,提示这个错误,用depends这工具加载dll,看第一层dll依赖关系,猜测可能缺少cc3260mt.dll,拷贝后果然解决了问题。

最后查资料说是静态动态链接的问题。去掉Use dynamic RTL选项。编译后dll体积变大,但是就不需要cc3260mt.dll了。在win10可运行正常,但是xp仍然报错,还需要努力。。。

最后找到原因,原来用vc编译好的openssl的库libeay32.dll 需要能支持xp才行。重新下载了一个别人已经编译好的版本就可以了。(提示,编译后的openssl.exe在xp上可以执行就能判断出来)