I have some global string variables.
I have to create the function that I could pass & store them in some structure.
Later I need to enumerate them and check their values.
how can this be easily achieved?
(I think I would need some kind of reflection, or store array of pointers).
Anyway, any help will be appreciated.
Thanks!
First of all you can’t use Delphi’s RTTI for that purpose, because Delphi 7’s RTTI only covers published members of classes. Even if you were on Delphi XE, there’s still no RTTI for global variables (because RTTI is tied to Types, not to “units”).
The only workable solution is to create your own variable registry and register your globals using a name and a pointer to the var itself.
Example:
were the RegisterXXX types would need to be defined somewhere, probably in there own unit, like this: