I came accross a strange thing, maybe it's stupid, or I don't have the knowledge of how linking actually works...
I have a project that builds in a static lib, and anoter project that builds in an exe and links to the static lib. Compiled with MSVC 2005, all works well, but what is strage is that the exe has 3 Mb and the lib has 11Mb. How is this possible? I mean, if i link the exe to the static lib, shouldn't all of the obj code be included in the exe?

thx in advance

Recommended Answers

All 3 Replies

It's a long shot, but maybe while optimizing compiler got rid of unneeded functions and code in library?

commented: Yes, except it's the linker, not the compiler. +21

It's a long shot, but maybe while optimizing compiler got rid of unneeded functions and code in library?

funny :), I just replyed to your thread :))
yea, that is possible

It's not an optimizing compiler, it's a linker does it!
That's why static libs were invented many many years ago ;)...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.