A uses clause lists units
used by the program, library, or unit in which the clause appears. (For
information about libraries, see Libraries and packages.) A
uses clause can occur in
·the project file for a
program or library,
·the interface section
of a unit, and
·the implementation
section of a unit.
Most
project files contain a uses clause, as do the interface sections of
most units. The implementation section of a unit can contain its own uses
clause as well.
The System
unit is used automatically by every application and cannot be listed explicitly
in the uses clause. (System implements routines for file I/O,
string handling, floating point operations, dynamic memory allocation, and so
forth.) Other standard library units, such as SysUtils, must be included
in the uses clause. In most cases, all necessary units are placed in the
uses clause when your project generates and maintains a source file.
For more information about the placement and content of the uses clause, see Multiple and indirect unit references, Circular unit references and Uses clause syntax.
Program structure and syntax:
Overview
Unit structure and syntax: Overview
Unit references and
the uses clause
Multiple and indirect
unit references
Multiple and indirect
unit references
Unit structure and syntax: Overview
uses子句列出了程序、库或单元等使用的单元。(更多关于库的信息,见库和包。)uses子句可以出现在:
· 程序(program)或库(library)的工程文件中;
· 单元的接口节;
· 单元的实现节。
System单元自动被每个应用程序使用而不在uses子句中显式地列出。(System单元实现了文件输入/输出,字符串处理,浮点运算、动态内存分配等例程。)其他的标准库单元,如SysUtils,则必需包括在uses子句中。大多数情况下,当一个工程产生并且保存在相应的源文件中时,所有必需的单元都已经被Borland集成开发环境自动置于uses子句中。
更多有关uses子句的布局和内容,见多重和间接单元应用、循环单元引用和uses子句的语法。