Quick start manual
Libraries and packages
9-11
Packages
where packageName is any valid identifier. The requiresClause and containsClause are
both optional. For example, the following code declares the DATAX package.
package DATAX;
requires
rtl,
clx;
contains Db, DBLocal, DBXpress, ... ;
end.
The requires clause lists other, external packages used by the package being
declared. It consists of the directive requires, followed by a comma-delimited list of
package names, followed by a semicolon. If a package does not reference other
packages, it does not need a requires clause.
The contains clause identifies the unit files to be compiled and bound into the
package. It consists of the directive contains, followed by a comma-delimited list of
unit names, followed by a semicolon. 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. For example,
On Windows:
contains MyUnit in 'C:\MyProject\MyUnit.pas'; // Windows
On Linux:
contains MyUnit in '/home/developer/MyProject/MyUnit.pas'; // Linux
Note
Thread-local variables (declared with threadvar) in a packaged unit cannot be
accessed from clients that use the package.
Naming packages
A compiled package involves several generated files. For example, the source file for
the package called DATAX is DATAX.dpk, from which the compiler generates an
executable and a binary image called
On Windows:
DATAX.bpl and DATAX.dcp
On Linux:
bplDATAX.so and DATAX.dcp.
DATAX is used to refer to the package in the requires clauses of other packages, or
when using the package in an application. Package names must be unique within a
project.