Search code examples
static-librariesstatic-linking

When I include a static library "libupnpx.a" in my project that is 6 MB, does this make my app 6 MB larger?


I have heard the compiler strips out unused code. But when I include a libupnpx.a static library archive of 6 MB, will this make app 6 MB larger? Or is this same as including the library source code directly?


Solution

  • You can generally expect that static linking and "including the library source code directly" will have equivalent impacts on the size of the resulting executable. There are be some minor cases in which this may not be strictly true, but generally speaking, they should be approximately equivalent.