Editing Package Source Files Manually

From RAD Studio
Jump to: navigation, search

Go Up to Creating and Editing Packages


Package source files, like project files, are generated by Delphi from information you supply. Like project files, they can also be edited manually. A package source file should be saved with the .dpk (Delphi package) extension to avoid confusion with other files containing Delphi source code.

To open a package source file in the Code editor:

  1. Open the package in RAD Studio.
  2. Right-click the package in the Project Manager and choose View > Source.
    • The package heading specifies the name for the package.
    • The requires clause lists other external packages used by the current package. If a package does not contain any units that use units in another package, then it doesn't need a requires clause.
    • The contains clause identifies the unit files to be compiled and bound into the package. All units used by contained units which do not exist in required packages will also be bound into the package, although they won't be listed in the contains clause (the compiler will give a warning).

For example, the following VCL code declares the MyPack package (which can be used to build the binary file "MyPack.bpl"):

 package MyPack;
{$R *.res}
    ...{compiler directives omitted}
requires
    rtl,
    vcl;
contains
    Db,
    NewComponent1 in 'NewComponent1.pas';
end.

See Also