The uses clause lists units that are incorporated into the program. These units may in turn have uses clauses of their own. For more information about the uses clause, see Unit references and the uses clause
Program structure and syntax:
Overview
Unit structure and syntax: Overview
Unit references and
the uses clause
Multiple and indirect
unit references
Program structure and syntax:
Overview
uses子句列出了合成到程序中的单元。这些单元中可能也有各自的uses子句。有关uses子句的更多信息,见单元引用和uses子句。
编者注
前面曾经介绍过,尽管程序中可以不含有uses子句,但编译器会自动为所有的程序和单元使用System单元。对于控制台应用程序以及其他一些特殊的应用程序,uses子句确实可以不出现在程序中,此时只是使用了唯一的标准单元:System。对于绝大多数情况下,程序(program)以及后面将介绍的库(library)等,都不可避免地要使用uses子句,因为Borland在VCL(Windows)和/或CLX(Linux)中提供了一个重要的对象实例Application(TApplication类的实例),在工程文件中几乎都会使用该实例。因此,IDE总是自动将Forms(在Linux中为QForms)单元添加到工程文件的uses子句中。