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
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
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.