Profiling DLL/LIB Bloat

前端 未结 8 2087
故里飘歌
故里飘歌 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:12

    If your DLL is this big because it's exporting C++ function with exceptionally long mangled names, an alternative is to use a .DEF file to export the functions by ordinal, without name (using NONAME in the .DEF file). Somewhat brittle, but it reduces the DLL size, EXE size and load times.

    See e.g. http://home.hiwaay.net/~georgech/WhitePapers/Exporting/Exp.htm

    0 讨论(0)
  • 2020-12-29 01:13

    If your end goal is only to trim the size of the DLL, then after tweaking compiler settings, you'll probably get the quickest results by running your DLL through UPX. UPX is an excellent compression utility for DLLs and EXEs; it's also open-source with a non-viral license, so it's okay to use in commercial/closed-source products.

    I've only had it turn up a virus warning on the highest compression setting (the brute-force option), so you'll probably be fine if you use a lower setting than that.

    0 讨论(0)
提交回复
热议问题