Size of a library and the executable

前端 未结 7 880
半阙折子戏
半阙折子戏 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:55

    Disclaimer: It's been a long time since I dealt with static linking, so take my answer with a grain of salt.

    You wrote: I was thinking it should add directly to the executable size and final exe size should be more than that?

    Naive linkers work exactly this way - back when I was doing hobby development for CP/M systems (a LONG time ago), this was a real problem.

    Modern linkers are smarter, however - they only link in the functions referenced by the original code, or as required.

提交回复
热议问题