简体   繁体   English

静态链接的 libcurl 是否仍然使用动态链接的库?

[英]Does a statically linked libcurl still use dynamically linked libraries?

*Disclaimer: I am a newbie who is trying to learn about how to use third party libraries. *免责声明:我是一个正在尝试学习如何使用第三方库的新手。 * *

I'm looking at using libcurl for a project and I want to statically link it to my project so that it is included in my final executable.我正在考虑将 libcurl 用于一个项目,并且我想将它静态链接到我的项目,以便它包含在我的最终可执行文件中。

Some documentation online says:一些在线文档说:

By default, configure will setup the build files so that the following make file command will create both shared and static versions of libcurl.默认情况下,configure 将设置构建文件,以便以下 make file 命令将创建 libcurl 的共享版本和 static 版本。 You can change that with the —disable-static and —disabled-shared options to configure.您可以使用—disable-static—disabled-shared选项进行配置来更改它。

If you instead want to build with static versions of third party libraries instead of shared libraries, you need to prepare yourself for an uphill battle....如果您想使用 static 版本的第三方库而不是共享库进行构建,则需要为艰苦的战斗做好准备......

Are they talking about the libraries that libcurl uses?他们是在谈论 libcurl 使用的库吗? I guess what I'm asking is: even if I build libcurl and link statically, will libcurl still be linking dynamically to 3rd party libraries?我想我要问的是:即使我构建 libcurl 并静态链接,libcurl 仍然会动态链接到 3rd 方库吗?

Is that what this is saying?这是在说什么吗?

The thing is, a static library is really nothing more than an archive of object files.问题是,static 库实际上只不过是 object 文件的存档。 Linking with a static library is the same as linking with the separate object files themselves.与 static 库链接与与单独的 object 文件本身链接相同。 That means that any 3rd party dependency that the library have also becomes a dependency for your application.这意味着该库具有的任何 3rd 方依赖项也将成为您的应用程序的依赖项。 And you must link with those 3rd party libraries and dependencies when you link your application.当您链接您的应用程序时,您必须链接那些第 3 方库和依赖项。

Now for libcurl itself, depending on how you configure and build libcurl, it may depend on some 3rd party libraries that can't be linked statically to your application.现在对于 libcurl 本身,根据您配置和构建 libcurl 的方式,它可能依赖于一些无法静态链接到您的应用程序的第三方库。

So to answer your question: It depends.所以回答你的问题:这取决于。

It mostly depends on how you configure it for building, and what 3rd party libraries you tell it to use, and if those 3rd party libraries are available as static libraries (and then on to their dependencies and so on).这主要取决于您如何配置它以进行构建,以及您告诉它使用哪些 3rd 方库,以及这些 3rd 方库是否可用作 static 库(然后是它们的依赖项等等)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM