简体   繁体   中英

Combine Dynamically Linked Libraries into one Statically Linked Library

What if I am creating a library which is meant to be super easy to use, but its dependencies are a real pain to install? If my library depends on a bunch of libraries, is it possible to create one library which contains all of the dependencies, so my library user doesnt need to fiddle around with installing each dependency separately? I understand that people do this with full applications, distributing binaries, but it'd be nice to realize that developers are people too and sometimes just want to get something done without needing to understand everything about every library.

(I'm thinking specifically about C and C++ here.)

You have a few options:

  1. Remove the dependencies. A lot of projects have dependencies that they do not really need.

  2. Ship the dynamically linked libraries you depend on, with your own built executables or libraries.

  3. Use a package manager to provide your dependencies so users don't have to build them from sources.

There is unfortunately no easy way to turn dynamically linked libraries into static ones. If you really want to try it (knowing it probably won't work out), see here: How can I convert dynamically linked application to statically one?

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