简体   繁体   中英

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.

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. You can change that with the —disable-static and —disabled-shared options to configure.

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....

Are they talking about the libraries that libcurl uses? 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?

Is that what this is saying?

The thing is, a static library is really nothing more than an archive of object files. Linking with a static library is the same as linking with the separate object files themselves. That means that any 3rd party dependency that the library have also becomes a dependency for your application. And you must link with those 3rd party libraries and dependencies when you link your application.

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.

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).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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