Profiling DLL/LIB Bloat

前端 未结 8 2162
故里飘歌
故里飘歌 2020-12-29 00:46

I\'ve inherited a fairly large C++ project in VS2005 which compiles to a DLL of about 5MB. I\'d like to cut down the size of the library so it loads faster over the network

8条回答
  •  清酒与你
    2020-12-29 01:00

    When you build your DLL, you can pass /MAP to the linker to have it generate a map file containing the addresses of all symbols in the resulting image. You will probably have to do some scripting to calculate the size of each symbol.

    Using a "strings" utility to scan your DLL might reveal unexpected or unused printable strings (e.g. resources, RCS IDs, __FILE__ macros, debugging messages, assertions, etc.).

    Also, if you're not already compiling with /Os enabled, it's worth a try.

提交回复
热议问题