How can I identify and get rid of unused units in the “uses clause” in Delphi 7?

后端 未结 7 717
北海茫月
北海茫月 2020-12-03 14:44

This should reduce the executable size quite a bit in some of my very large projects. I am sure there would be other benefits too.

EDIT: Is there perhaps a utility t

7条回答
  •  青春惊慌失措
    2020-12-03 15:03

    Remember that the linker will strip anything that can't be called. If no use is made of a unit and it has no initialization or finalization it's going to be completely stripped anyway. Anything referenced in the initialization or finalization will stay but in general this shouldn't bring in much anyway.

    It's possible for a unit to consist of only initialization so full-auto stripping is limited anyway. Units which merely change system behavior in some fashion might very well have no references and yet be needed. (The replacement memory manager with good leak tracking comes to mind. While it does have things you can reference there's no need to, just use it and get the leak report. Nice double-check for your code.)

提交回复
热议问题