Re: -staticlib flag for building standalone static libraries producing very large libraries
On Sat, 2015-03-07 at 22:18 +1100, Sean Seefried wrote:
> Hi all,
> Can anyone explain the following problem I'm having?
> I'm currently writing a game in Haskell. When I produce a plain old
> executable (for local testing) it's about 23M. However, when I create a
> static lib using the -staticlib flag it is 54M.
Most likely that is because executable contains only necessary/used
definitions, while static lib is just an archive of all object files,
including all dependencies.
Note also that by default core libs are compiled using --split-objs, so
when linking executable, all unused top level definitions are filtered
out. (And you can decrease size of the executable even more by compiling
it and all its dependencies using --split-objs if you are not using it
already.) Without the flag, unused definitions are filtered out on per
(I'm not an expert here, so the above description can be partially or
totally wrong :) )