RAD Studio
ContentsIndex
PreviousUpNext
Loading Packages in an Application

You can dynamically load packages by either:

To load packages using the >Project>Options dialog box

  1. Load or create a project in the IDE.
  2. Choose ProjectOptions.
  3. Choose the Packages tab.
  4. Select the Build with Runtime Packages check box, and enter one or more package names in the edit box underneath. Each package is loaded implicitly only when it is needed (that is, when you refer to an object defined in one of the units in that package). (Runtime packages associated with installed design-time packages are already listed in the edit box.)
  5. To add a package to an existing list, click the Add button and enter the name of the new package in the Add Runtime Package dialog. To browse from a list of available packages, click the Add button, then click the Browse button next to the Package Name edit box in the Add Runtime Package dialog. If you edit the Search Path edit box in the Add Runtime Package dialog, you can change the global Library Path. You do not need to include file extensions with package names (or the version number representing the Delphi release); that is, vcl90.bpl in a VCL application is written as vcl. If you type directly into the Runtime Package edit box, be sure to separate multiple names with semicolons. For example:

rtl;vcl;vcldb;vclado;

vclbde;

Packages listed in the Runtime Packages edit box are automatically linked to your application when you compile. Duplicate package names are ignored, and if the Build with runtime packages check box is unchecked, the application is compiled without packages. Runtime packages are selected for the current project only. To make the current choices into automatic defaults for new projects, select the Defaults check box at the bottom of the dialog.

Note: When you create an application with packages, you must include the names of the original Delphi units in the uses clause of your source files. For example, the source file for your main form might begin like this:

unit MainForm;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;

#include "vcldb.h"

The units referenced in this VCL example are contained in the vcl and rtl packages. Nonetheless, you must keep these references in the uses clause, even if you use vcl and rtl in your application, or you will get compiler errors. In generated source files, the Form Designer adds these units to the uses clause automatically.

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!