Next: , Previous: Update, Up: Reference



uses

Synopsis

In a program:

     program @@fragment foo;
     
     uses
       bar1,
       bar2 in 'baz.pas',
       bar3;
     
     [...]

In a unit:

     unit @@fragment Bar3;
     
     interface
     
     uses
       bar1,
       bar2 in 'baz.pas';
     
     [...]
     
     implementation
     
     uses
       bar3,
       bar4 in 'qux.pas';
     
     [...]

Description

The reserved word uses in the import part of a program or unit makes the program or unit import an interface.

The keyword in tells GPC to look for the unit in the specified file; otherwise the file name is derived from the name of the interface, coverted to lower-case, by adding first .p, then .pas.

In BP, there must be at most one uses part in a program, and in a unit, there can be one import part in the interface part and one in the implementation part. GPC, as an extention, allows for several uses parts, and also allows uses parts in a module.

The imported interface needn't be a UCSD/Borland Pascal unit, it may be an interface exported by an Extended Pascal module as well.

Conforming to

ISO Pascal does not define uses and units at all. UCSD and Borland Pascal do, but without the in extension. Delphi supports uses like described above.

Example

See also

Keywords, unit, module, import.