I have a portable exe
application that is distributed alongside with dll
files in one directory. I know that it for sure doesn't use all the functions in the provided libs. Are any tools available to cut out unused functions and reduce dll
size?
-
1Is this DLL used by only one executable, and are you sure it won't be called by another program you will install in the future? Note that some program construct method calls dynamically, in such case removing functions is risky: stackoverflow.com/a/9957210/226958– Nicolas Raoul ♦Apr 7, 2014 at 9:04
-
@NicolasRaoul I am sure that this DLLs will be used by only one executable because, as I said, they are distributed with exe in one folder and not installed system-wide. As for risks, thanks for the info, though I would like to give it a try.– userApr 7, 2014 at 9:09
-
4If your goal is merely to reduce DLL size, UPX is another solution; it can shrink both EXEs and DLLs. Sadly, using UPX increases the likelihood of triggering false positives in anti-virus products.– BrianApr 9, 2014 at 20:26
1 Answer
Assuming you have access to the source code and tool set to build the original DDL, (safest way to remove functionality), I would suggest the following steps:
- Save the original DLL somewhere safe.
- Ditto the source code for the DLL.
- Build the DLL yourself and test your program with it to make sure it all runs.
- Remove from the DLL build process everything other than what you know it will need.
- Try building the DLL again, and your program with the updated imports, it will probably fail moaning about missing items, add those back until it all builds.
- Test again thoroughly - when it fails diagnose what is missing and add that back in. - Repeat until happy.
I would seriously consider renaming the DLL at stage 3 and leaving it with the new name so as to avoid any possibility of conflicts.