Hi, thank you all for the feedback. sorry for the delay to answer.
Yes, actually I need to check if an *undeclared* variable inside a reusable unit has been declared globaly in the main or parent unit of the application and in that case do certain things. I guess that the {$IF DECLARED x} suggested does what I was trying to ask. It's ok to be just in compile time.
Probably, as you suggested, is much better to restructure the code. In some projects I make use of that global variable, in others dont. For that reason I try to decouple dependencies between main unit an reusable ones introducing some sort of code to check the declaration of this global variable. But as you said, it would be wise to simplify and restructure code, I tend to always pick up the complex path.
The question: {IF DECLARED x} will also work when checking in compile time the declaration of a global variable in the main unit, or it only checks it in the unit where the {$if declared x} is written? I am not sure if I explain myself clearly.
thanks,