The variables must be declared in a variable declaration block of a unit or a procedure or function
(section 16.5, page 836). It looks as follows:
This means that the following are valid variable declarations:
curterm1 : integer;
curterm2 : integer; cvar;
curterm3 : integer; cvar; external;
curterm4 : integer; external name ’curterm3’;
curterm5 : integer; external ’libc’ name ’curterm9’;
curterm6 : integer absolute curterm1;
curterm7 : integer; cvar; export;
curterm8 : integer; cvar; public;
curterm9 : integer; export name ’me’;
curterm10 : integer; public name ’ma’;
curterm11 : integer = 1 ;
The difference between these declarations is as follows:
- The first form (curterm1) defines a regular variable. The compiler manages everything
- The second form (curterm2) declares also a regular variable, but specifies that the
assembler name for this variable equals the name of the variable as written in the
- The third form (curterm3) declares a variable which is located externally: the compiler
will assume memory is located elsewhere, and that the assembler name of this location
is specified by the name of the variable, as written in the source. The name may not
- The fourth form is completely equivalent to the third, it declares a variable which is
stored externally, and explicitly gives the assembler name of the location. If cvar is
not used, the name must be specified.
- The fifth form is a variant of the fourth form, only the name of the library in which
the memory is reserved is specified as well.
- The sixth form declares a variable (curterm6), and tells the compiler that it is stored
in the same location as another variable (curterm1).
- The seventh form declares a variable (curterm7), and tells the compiler that the
assembler label of this variable should be the name of the variable (case sensitive) and
must be made public. i.e. it can be referenced from other object files.
- The eighth form (curterm8) is equivalent to the seventh: ’public’ is an alias for ’export’.
- The ninth and tenth form are equivalent: they specify the assembler name of the
- the elevents form declares a variable (curterm11) and initializes it with a value (1 in
the above case).
Note that assembler names must be unique. It’s not possible to declare or export 2 variables with
the same assembler name.