[Libav-user] reduce dll size

Alex Cohn alexcohn at netvision.net.il
Tue Mar 25 22:27:07 CET 2014


On Tue, Mar 25, 2014 at 9:45 PM, Michael Chisholm <chisholm at mitre.org> wrote:
> It seems to me, what you may gain by linking to a static lib, is that only
> that library code which is actually used by the app is pulled in to the exe

Yes and no. With "normal" linker, the granularity is on the OBJ level,
which has one-to-one relationship with compilation units, a.k.a. C
files. This means that if we have a huge C file with only one little
function used in our app, we still have all this code linked into our
app. Some linkers allow extra "optimization" and can eliminate unused
functions from an OBJ.

> (right?  It pulls in some subset of the *.o's from the *.a).  If you bundle
> all the DLLs, you include everything that was compiled into the libraries,
> whether the app actually uses it or not.  That's a good point, but I don't
> think it's about code duplication, is it?

You are right, and the major concern is about these unused OBJs. Yiran
Li was worried more about another kind of extra fat: that each DLL may
also contain its own copy of some functions from LIBM. There may be
some truth to that, but its effect is probably negligible.

Anyways, the experiment I describe can provide the lower estimate of
what can be achieved by manipulation of the DLLs.

Sincerely,
Alex Cohn


More information about the Libav-user mailing list