Exists the possibility for declare (uses) a UNIT in Project (.DPR or other location) and show in All Forms? (without necessary redeclare uses in Form the Form), a Global UNIT declarated one time in Project and visible to All Form/Units.
Asked
Active
Viewed 176 times
2 Answers
5
No. You can't use a unit in a single place and make it visible globally. It has to be included in a uses
clause in each unit's interface
or implementation
section in order to be visible in that unit. The Delphi compiler automatically makes System
(and in recent Delphi versions SysInit
) be included in each unit, but there's nothing that will do that for your own units.

Ken White
- 123,280
- 14
- 225
- 444
-
Is `SysUtils` really auto-included now? Or maybe you [meant `SysInit` instead](http://docwiki.embarcadero.com/RADStudio/en/Programs_and_Units_(Delphi))? "*The System unit **and the SysInit unit** are used automatically by every application and cannot be listed explicitly in the `uses` clause.*" – Remy Lebeau Apr 02 '20 at 03:15
-
1@RemyLebeau: Oops! Yep, SysInit is what I meant. Thanks for pointing it out. – Ken White Apr 02 '20 at 03:18
1
The feature you ask is not existing. But your can do something that has the same effect: use a .inc file.
Create a .inc file with the list of all common units you require. The add this include file in the uses clause of all unit.

fpiette
- 11,983
- 1
- 24
- 46