From: marcov@stack.nl   
      
   On 2005-04-21, Ruud Baltissen wrote:   
   > I want to use $define, $ifdef etc. in a program with quite some units.   
   > Now it seems I have to put a $define in every unit. I had hoped that I   
   > only had to place it in the main program or in a specific unit, but   
   > no, it seems I have to place it in every unit.   
   > Am I doing something wrong?   
      
   No. This is normal. Preprocessor state that flows over unit bounderies would   
   nullify the unit system.   
      
   E.g. assume you had these two units:   
      
   unit a;   
      
   interface   
   {$define x}   
      
   uses c;   
      
   implementation   
   end.   
      
      
   unit b;   
      
   interface   
      
   uses c;   
      
   implementation   
   end.   
      
   and a main program that includes both unit a and b. What version of C would   
   be linked in? The one that is compiled with "x" define or not?   
      
   Keep in mind that BP/FPC can simply also include source outside of the unit   
   system using {$i or {$include   
      
   So the best way is to make a file with a few defines and include that in all   
   units just after the interface line.   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|