Hi! On Thu, Jan 02, 2003 at 09:55:05AM +0100, Silvio a Beccara wrote:
I want the units to share the same, initialised variables.
Just use a unit, where all common variables are defined. Example: { B1: Unit, where rho is defined } unit B1; interface var Rho: Real; implementation to begin do begin Rho := 0.01 end; end. { B2: Unit uses Rho } unit b2; interface procedure UseRho; implementation uses b1; procedure UseRho; begin WriteLn ('Rho is in B2: ', Rho : 0 : 3) end; end. { "Main"-Program Foo } program Foo; uses b1, b2; begin WriteLn (Rho : 0 : 3); UseRho end. Please note, that global variables are a place of hard to find bugs (e.g. local variables might shadow global variables). It is better to use routines having parameters: function Calculate (MyRho: Real): Real; begin { do some calculations } { ... } WriteLn ('MyRho is: ', MyRho : 0 : 3); Calculate := { ... } Sin (MyRho) end; Eike