Originally Posted by greekgoddj
Greetings,
I have a .lib which is like 23MB and has a lot, and I mean a lot of functions in it. lets call this "A.lib". If I make an executable that uses a few functions from A.lib, then the compiler/linker knows to only include the code from A.lib that is needed into my new executable and as a result the size of the executable is small.
Now I want to make a .lib of my own which uses some of the functions of A.Lib. let's call the new library B.Lib. I include A.lib and its header, use the functios I need from A.lib in my code and then compile. The problem here is that the compiler/linker is not clever enough to copy only the code for the functions from A.lib that I need, and it copies the entire A.lib inside my B.lib. So B.lib is also over 23MB! Then if I make other libs such as C.lib and D.lib, that use B.lib, they are bigger than 23MB.
But, if I include B.lib, C.lib, or D.lib in an executable, the compiler knows to only use the code that is need and the executable is again small.
What is goingon? How come the compiler knows only to use the needed code only when compiling applications and not libraries?