Name

Requires Directive

Syntax

package Name;
requires
  OtherName, ...;
end.

Description

The requires directive begins a list of package names that are required to build package Name. The package names are separated by commas.

Tips and Tricks

  • When Delphi compiles a package, it must locate every unit contained in the package and every unit used by the contained units. All the units are partitioned into two groups: units contained in the required packages, and all others. The latter units are the ones that Delphi compiles into the new package. If you don’t want a unit to be contained in a package, that unit must be contained in a different package, which is required by the package you are compiling.

  • Usually, you will use Delphi’s package editor to add or remove required packages. You can edit the package source manually, but doing so does not update the package editor. Close and reopen the project or project group to force Delphi to read the new package source file.

  • Delphi’s IDE does not always treat a package as a project. If you have difficulties with the IDE, try creating a new project group, then add the package to the project group.

  • Packages are DLLs, so Windows finds a package file the same way it finds any DLL. You cannot specify a complete path when listing a required package—only the package name.

See Also

Contains Directive, Package Directive

Get Delphi in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.