[fpc-pascal] using units in units...

David Emerson dle3ab at angelbase.com
Wed Dec 8 00:27:23 CET 2004


You need to put your "uses" list inside either the interface or the implementation of the unit. You can even put different lists in the interface and implementation sections (though you can't list the same unit in BOTH lists). Usually the implementation section will have a longer uses list; the interface only needs a uses list for types, including object types, etc., which appear in the interface.

I'm not sure about it, but it may even be possible to put a uses list inside initialization and/or finalization sections.

~David.

 -------- Original Message --------
> From: Ron Weidner <xecronix at yahoo.com>
> Sent: Tuesday, December 07, 2004 2:30 PM
> To: Agustin Barto <abarto at gmail.com>, FPC-Pascal users discussions <fpc-pascal at lists.freepascal.org>
> Subject: [fpc-pascal] using units in units...
> 
> I'm looking for a little syntax help please.  How do
> you use units in a unit?  The following doesn't work.
> 
> unit unit_test;
> uses crt;
> interface
>     function make_line(): String;
> 
> implementation
>     function make_line(): String;
>     begin
>          make_line := 'This is a string returned';
>     end;
> end.
> 
> What I'm trying to accomplish in my program is I want
> to create a file called defs.pas.  this would contain
> all the constants for all the units that make up the
> prgram.  For example, there might be a constant
> SCREEN_WIDTH or SCREEN_HEIGHT.  Now I want to be 
> able to use those varibles in the units, Collide.pas
> and Draw.pas.  How is this done in Pascal.
> 
> Ron_W
> 
> 
> 
> 
> 
> 		
> __________________________________ 
> Do you Yahoo!? 
> The all-new My Yahoo! - What will yours do?
> http://my.yahoo.com 
> 
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal 







More information about the fpc-pascal mailing list