Size of a library and the executable

前端 未结 7 922
半阙折子戏
半阙折子戏 2021-02-14 12:14

I have a static library *.lib created using MSVC on windows. The size of library is say 70KB. Then I have an application which links this library. But now the size of the final

7条回答
  •  南旧
    南旧 (楼主)
    2021-02-14 12:41

    @All: Thanks for the pointers. @Greg Hewgill - Your answer was a good pointer. Thanks.

    The answer i found out was as follows:

    1.)During Library building what happens is if the option "Keep Program debug databse" in MSVC (or something alike ) is ON, then library will have this debug info bloating its size. but when i statically include that library and create a executable, the linker strips all that debug info from the library before geenrating the exe and hence the exe size is less than that of the library.

    2.) When i disabled the option "Keep Program debug databse", i got an library whose size was smaller than the final executable, which was what i thought is nromal in most situations.

    -AD

提交回复
热议问题