[next] [tail] [up]

#### Mangled names for data blocks

The rules for mangled names for variables and typed constants are as follows:

- All variable names are converted to upper case
- Variables in the main program or private to a unit have an _ prepended to their names
- Typed constants in the main program have an TC__ prepended to their names
- Public variables in a unit have their unit name prepended to them : U_UNITNAME_
- Public and private typed constants in a unit have their unit name prepended to them :TC__UNITNAME$$

Currently, in Free Pascal v1.0, if you declare a variable in unit name tunit, with the name _a, and you declare the same variable with name a in unit name tunit_, you will get the same mangled name. This is a limitation of the compiler which will be fixed in release v1.1.

Examples

     unit testvars;

     interface

     const
      publictypedconst : integer = 0;
     var
      publicvar : integer;

     implementation
     const
      privatetypedconst : integer = 1;
     var
      privatevar : integer;

     end.

Will give the following assembler output under GNU as :

     .file "testvars.pas"

     .text

     .data
     # [6] publictypedconst : integer = 0;
     .globl TC__TESTVARS$$_PUBLICTYPEDCONST
     TC__TESTVARS$$_PUBLICTYPEDCONST:
     .short 0
     # [12] privatetypedconst : integer = 1;
     TC__TESTVARS$$_PRIVATETYPEDCONST:
     .short 1

     .bss
     # [8] publicvar : integer;
     .comm U_TESTVARS_PUBLICVAR,2
     # [14] privatevar : integer;
     .lcomm _PRIVATEVAR,2

[next] [front] [up]