Delphi: Declare global variable in DPR and access variable in all units
Question by Compi | 2013-02-09 at 22:23
In a Delphi project, I need a global variable that is visible in all units and which I can access in all units. Therefore, I would like to declare this variable directly in the Delphi project file (DPR). However, I can not access the variable from other units. What am I doing wrong?
Related Topics
Delphi: Define global variables
Tip | 0 Comments
Lazarus: Detect Operating System (Compiler Switch)
Tutorial | 0 Comments
Delphi: Global Treatment of Errors (Exceptions)
Tutorial | 0 Comments
Website Performance: Caching and Expires Header for Images, CSS and JavaScript
Tutorial | 0 Comments
Units: SI Prefixes for Powers of Ten
Info | 0 Comments
Delphi: System-Wide HotKey
Tutorial | 1 Comment
Delphi/Lazarus: Is the ALT, SHIFT or CTRL key pressed?
Tutorial | 0 Comments
Important Note
Please note: The contributions published on askingbox.com are contributions of users and should not substitute professional advice. They are not verified by independents and do not necessarily reflect the opinion of askingbox.com. Learn more.
Participate
Ask your own question or write your own article on askingbox.com. That’s how it’s done.
I do not recommend declaring variables directly in the DPR because that is contrary to the hierarchy of Delphi.
But I have explained in the tip define global variables in Delphi, how to best declare a global variable in Delphi, so that you can read, write and access this variable in all units, including the DPR.
2013-02-11 at 15:03