On 3/25/2014 5:27 PM, Alex Cohn wrote:
On Tue, Mar 25, 2014 at 9:45 PM, Michael Chisholm <[email protected]> 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.


Yes, it would show how well you could do by paring down DLLs along object boundaries.

I think you can get duplication and other weirdness if you mix static and dynamic linking. E.g. if multiple DLLs statically link to the same library, and then the app dynamically links to the DLLs. Each DLL could wind up with its own copy of the static lib, so the app would have multiple copies. But what Yiran's toolchain does when you pass "-lm" on the link commandline is beyond the purview of ffmpeg I think. I also don't think the ffmpeg build process explicitly mixes the linking styles together among the libs it builds, so the code duplication concern (due to linking style) seems like a moot point as far as ffmpeg goes. That was the original topic of the big thread: how do I build one monolithic DLL so that there is no code duplication. The libm concern seemed to me more like grasping at straws.

So we're down to paring away objects from libraries. If you use static libraries, the linker does it for you and you don't have to bundle separate ffmpeg library dependencies. That seems easier. If you use dynamic libraries, you do have to bundle separate DLLs, and if you don't like how the existing build process builds them, you're in for a bunch of manual labor doing it yourself... that seems like the hard route.

Andy


_______________________________________________
Libav-user mailing list
[email protected]
http://ffmpeg.org/mailman/listinfo/libav-user

Reply via email to