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 for clients who use it from a slow network share.
I know how to do this by analyzing the code, includes, and project settings, but I'm wondering if there are any tools available which could make it easier to pinpoint what parts of the code are consuming the most space. Is there any way to generate a "profile" of the DLL layout? A report of what is consuming space in the library image and how much?
While i don't know about any binary size profilers, you could alternatively look for what object files (.obj) are the biggest - that gives you at least an idea of where your problematic spots are.
Of course this requires a sufficiently modularized project.
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 (usingNONAME
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