Dot.Hu
11/21/2008 5:42:00 PM
On Nov 20, 6:33 pm, Maxim Yegorushkin <maxim.yegorush...@gmail.com>
wrote:
> On Nov 20, 6:35 am, "Dot.Hu" <huhang...@gmail.com> wrote:
>
> > I'm using static libraries and dynamic libraries every day.
> > Now I want to know when I add one static library into my project, the
> > libray will be all added into the final exe file, or only the part I
> > use is added?
>
> A .lib file is basically an archive of .o/.obj files. The linker links
> in only those .obj files from the archive that define the symbols that
> are unresolved in the binary being linked. In other words, if you link
> against a .lib, but the binary being link does not use any of the
> symbols from the .lib, that .lib is not contributing to the size of
> the resulting binary.
>
> --
> Max
Thanks very much, Max.
I got another question.
Once one symbol is used of one .lib, then the whole .lib will be
linked into the exe?
Now I want to create some libraries, where my useful codes will
reside.
But I don't want to increase the size of .exe, because of some unused
symbols.
That's why I post this question.