添加两个dll到msvc 2010应用程序
我正在尝试在我的应用程序中使用 libcurl 库。 当我启动我的应用程序时,它要求 libcurl.dll 和 zlib1.dll 存在于同一文件夹中。当我添加它们时,一切正常,但我想包括 它们到可执行文件。
如何将两个 dll 静态添加到应用程序中?
I'm trying to use libcurl library in my application.
when i start my application, it asks for libcurl.dll and zlib1.dll
to exist in the same folder. when i add them everything works fine but i want to include
them to the executable.
how can i statically add both dll's to the application?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您无法将 dll 静态链接到可执行文件中。动态库的目的是在运行时从外部映像(dll 文件)动态加载。您应该检查curl 和zlib 是否提供正确的静态库并链接它们而不是dll 的lib 存根。
请考虑,链接静态外部库会使您的二进制文件可能容易受到静态链接 blob 中任何安全问题的影响。这意味着您必须更新与这些库静态链接的任何二进制文件,而不是简单地更新库本身。
You cannot statically link dlls into an executable. The purpose of dynamic libraries is to be loaded dynamically during runtime from an external image (dll file). You should check whether curl and zlib provide proper static libraries and link against them instead of lib stubs for the dlls.
Consider that linking against static external libraries makes your binary potentially vulnerable against any security issues in statically linked blobs. That means that you will have to update any binary you statically linked against those libraries instead of simply updating the libraries themselves.