Node:import, Next:, Previous:implementation, Up:Reference



import

Synopsis


program @@fragment foo;

import
  bar1;
  bar3 (baz1 => glork1) in 'baz.pas';
  bar2 only (baz2, baz3 => glork2);

[...]

Description

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

The in above tells GPC to look for the module in the specified file; otherwise the file name is derived from the name of the interface by adding first .p, then .pas - which only works if the name of the exported interface coincides with the file name.

The symbol => denotes import renaming: The entity which is exported under the name baz1 by the interface bar3 will be known under the new name glork1 in the program.

The only qualifier means that only the listed identifiers will be imported from the interface. Renaming works together with only, too.

There must be at most one import part in a program.

The interfaces needn't be exported by Extended Pascal modules but may be UCSD/Borland Pascal units as well.

Conforming to

import and modules in general are an ISO 10206 Extended Pascal extension.

GNU Pascal does not yet support qualified import.

Example

See also

Keywords, module, unit, uses.