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?

  • 1
    Is 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
    Commented 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.
    – user
    Commented Apr 7, 2014 at 9:09
  • 4
    If 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.
    – Brian
    Commented Apr 9, 2014 at 20:26

1 Answer 1


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:

  1. Save the original DLL somewhere safe.
  2. Ditto the source code for the DLL.
  3. Build the DLL yourself and test your program with it to make sure it all runs.
  4. Remove from the DLL build process everything other than what you know it will need.
  5. 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.
  6. 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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.