Delphi Language Guide Delphi for Microsoft Win32 Delphi for the Microsoft. Net framework



Yüklə 0,84 Mb.
Pdf görüntüsü
səhifə29/294
tarix02.01.2022
ölçüsü0,84 Mb.
#41395
1   ...   25   26   27   28   29   30   31   32   ...   294
DelphiLanguageGuide

The Syntax of a Uses Clause
A uses clause consists of the reserved word uses, followed by one or more comma delimited unit names, followed
by a semicolon. Examples:
uses Forms, Main;
uses 
   Forms,
   Main;
uses Windows, Messages, SysUtils, Strings, Classes, Unit2, MyUnit;
In the uses clause of a program or library, any unit name may be followed by the reserved word in and the name of
a source file, with or without a directory path, in single quotation marks; directory paths can be absolute or relative.
Examples:
uses 
   Windows, Messages, SysUtils,
   Strings in 'C:\Classes\Strings.pas', Classes;
Use the keyword in after a unit name when you need to specify the unit's source file. Since the IDE expects unit
names to match the names of the source files in which they reside, there is usually no reason to do this. Using in is
necessary only when the location of the source file is unclear, for example when
You have used a source file that is in a different directory from the project file, and that directory is not in the
compiler's search path.
Different directories in the compiler's search path have identically named units.
You are compiling a console application from the command line, and you have named a unit with an identifier
that doesn't match the name of its source file.
The compiler also relies on the in ... construction to determine which units are part of a project. Only units that appear
in a project (.dpr) file's uses clause followed by in and a file name are considered to be part of the project; other units
in the uses clause are used by the project without belonging to it. This distinction has no effect on compilation, but
it affects IDE tools like the Project Manager.
In the uses clause of a unit, you cannot use in to tell the compiler where to find a source file. Every unit must be in
the compiler's search path. Moreover, unit names must match the names of their source files.

Yüklə 0,84 Mb.

Dostları ilə paylaş:
1   ...   25   26   27   28   29   30   31   32   ...   294




Verilənlər bazası müəlliflik hüququ ilə müdafiə olunur ©azkurs.org 2024
rəhbərliyinə müraciət

gir | qeydiyyatdan keç
    Ana səhifə


yükləyin