The unit
heading specifies the unit’s name. It consists of the reserved word unit,
followed by a valid identifier, followed by a semicolon. For applications
developed using Borland tools, the identifier must match the unit file name.
Thus, the unit heading
unit
MainForm;
would occur in a source file called
MAINFORM.pas, and the file containing the compiled unit would be MAINFORM.dcu.
Unit names must be unique within a project. Even if their unit files are in different directories, two units with the same name cannot be used in a single program.
Program structure and syntax:
Overview
Unit structure and syntax: Overview
Unit references and
the uses clause
Multiple and indirect
unit references
Unit structure and syntax: Overview
单元首部指定单元名,它由保留字unit、用于表示单元名的有效标识符、分号(;)顺序组合组成。用Borland工具开发的应用程序中,此处的标识符必需与相应单元的文件相匹配,例如,对于程序首部
unit
MainForm;
其相应的源文件名为MAINFORM.pas(大小写不敏感),编译过的单元文件名为MAINFORM.dcu(大小写不敏感)。
在同一个项目中,单元名必需唯一。即使两个或多个同名单元位于不同的目录中,它们也不能用于同一个程序。