Borland Help Contents Menu
MS Help Contents Menu
When moving a package to another machine, copy
(These are the default directories. I actually use different directories and modify Delphi so that it can find them. See Tools / Environment Options.. / Library.)
Also copy the design time resource file
Path on my system | Extensions |
---|---|
C:Program FilesBorlandDelphi5Bin | bpl, dll |
C:Program FilesBorlandDelphi5ProjectsBpl | its up to you |
C:Program FilesBorlandDelphi5Projects | exe (default output directory) |
Same directory as your exe | exe (custom output directory) |
In one test case (just a simple form), the exe file was 15 kb using bpl's, and 356 kb using dcu's. (In another test, just a form and no components, it was 14 kb and 298 kb.)
In order to debug a component (set break points), the *.dcu and *.pas files should be in the same directory or at least the source file needs to be in the Debug Source Path (Project / Options.. / Directories).
In order to step through vcl code, the *.dcu files are already in the search path. Therefore, you only need to include the *.pas files in Delphi5SourceVcl in the Debug Source Path.
It appears that there may be a small difference between machines. Today (5-2003), I had to enable the use of Debug DCUs in order to step through the VCL files - Project / Options.. / Compiler / Use Debug DCUs - and Delphi5SourceVcl was NOT in the Debug Source Path. I don't know how I was able to step through the VCL before.
Including *.dcu files (one of the options) seems to have no purpose - it still tries to find the *.pas files when it compiles.
By default, your *.bpl and *.dcp files are placed in
In general, this is good because it is already in the necessary path definitions. However, I prefer to keep everything related to a project in a single directory tree. As a result, I suggest that you change to point elsewhere. (BPL output directory is not available in Delphi 6, but appears to be controlled viaI have also used this structure
This will allow you to zip the tree and distribute a smaller file.I do not suggest using
to change the output directories because that will affect all projects .. and only a specific project should be assigned to a directory that is named for it.Note: In Delphi 5, the output paths can not be set using the Delphi menu. Instead, you have to manually edit dcl_xxx50.dof (stored in ini file format).
I have tested this with relative paths, as shown above.However, because the resulting file is over 2 Mb, and redistributes a file (vcl50.bpl) that should never (IMHO) be redistributed, I do not suggest using this. (vcl50.bpl is required for the package to install .. but it is either already on the developer's machine or the user has the wrong version of Delphi. On the other hand, vcl50.bpl is required on an end user's machine if the application is configured to 'Build with runtime packages'.)
To create a new collection, from the Delphi menu, select Tools / Package Collection Editor.
Identify your package collection under Author/Vendor name and add a couple of directories to the Directory list. The Directory name is what appears in the comboboxes. For example
In the editor, select Add a package from either the menu or the toolbar. Once you've included a package, select Add a file group (it helps a lot if you name your group - it gives you something to click on later). You should probably have several groups - the *.dcu files are mandatory, but you might make the source files optional. Click the Auto.. button to locate ALL the source
That's right - you must recompile your components for each Delphi version. (I don't remember seeing this in any of the references.)
I tried to install a component compiled in Delphi 5 into Delphi 6 .. an error said that it required vcl50.bpl. So I found that and placed it in C:WINDOWSsystem32, but it is not compatible with vcl60.bpl because they both have the same objects.
As a result, I had to re-compile the source in Delphi 6.
Because of this, I recommend that you always include a Delphi version indicator in the package filename.
This is copied from the Delphi 5 help (from Deploying packages)
Description |
You can also load a package at runtime by calling the LoadPackage function. LoadPackage loads the package specified by its name parameter, checks for duplicate units, and calls the initialization blocks of all units contained in the package. For example, the following code could be executed when a file is chosen in a file-selection dialog. |
A package is a special dynamic-link library used by applications, the IDE, or both. Runtime packages provide functionality when a user runs an application. Design-time packages are used to install components in the IDE and to create special property editors for custom components. A single package can function at both design time and runtime, and design-time packages frequently work by calling runtime packages. To distinguish them from other DLLs, package libraries are stored in files that end with the .bpl (Borland package library) extension. Like other runtime libraries, packages contain code that can be shared among applications. For.. more |
You can compile a package from the IDE or from the command line. |
Creating a package involves specifying:
|
Refer to Understanding the structure of a package for more information about the steps outlined here. |
A custom package is either a .bpl you code and compile yourself or an existing package from a third-party vendor. To use a custom runtime package with an application, choose ProjectOptions and add the name of the package to the Runtime Packages edit box on the Packages page. For example, suppose you have a statistical package called stats.bpl. To use it in an application, the line you enter in the Runtime Packages edit box might look like this: |
Several runtime packages, including rtl and vcl (VCL application) , supply basic language and component support. The vcl (VCL) package contains the most commonly used components; the rtl package includes all the non-component system functions and Windows interface elements. It does not include database or other special components, which are available in separate packages. To create a client/server database application that uses packages, you need several runtime packages, including vcl, vcldb, rtl, and dbrtl (VCL) . If you want to use visual components in your application, you also need vclx (VCL) . To use these packages, choose ProjectOptions,.. more |
You deploy packages much like you deploy other applications. The files you distribute with a deployed package may vary. The bpl and any packages or dlls required by the bpl must be distributed. Files deployed with a package |
Design-time packages are used to install components on the IDE's Tool palette and to create special property editors for custom components. Which ones are installed depends on which edition of Delphi you are using and whether or not you have customized it. You can view a list of what packages are installed on your system by choosing ComponentInstall Packages... The design-time packages work by calling runtime packages, which they reference in their Requires clause. For example, dclstd references vcl. The dclstd itself contains additional functionality that makes many of the standard components available on the Tool palette.. more |
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 Del source code. |
All components are installed in the IDE as packages. If you've written your own components, create and compile a package that contains them. Your component source code must follow the model described in Overview of component creation. |
Package collections (.dpc files) offer a convenient way to distribute packages to other developers. Each package collection contains one or more packages, including bpls and any additional files you want to distribute with them. When a package collection is selected for IDE installation, its constituent files are automatically extracted from their .pce container; the Installation dialog box offers a choice of installing all packages in the collection or installing packages selectively. |
To create a package, you compile a source file that has a .dpk extension. The base name of the .dpk file becomes the base name of the files generated by the compiler. For example, if you compile a package source file called traypak.dpk, the compiler creates a package called traypak.bpl. |
Create a package when you want to make a custom component that's available through the IDE. Create a standard DLL when you want to build a library that can be called from any application, regardless of the development tool used to build the application. The following table lists the file types associated with packages: Package files |
The following table lists package-specific compiler directives that you can insert into your source code. Package-specific compiler directives |
Runtime packages are deployed with your applications. They provide functionality when a user runs the application. To run an application that uses packages, a computer must have both the application's executable file and all the packages (.bpl files) that the application uses. The .bpl files must be on the system path for an application to use them. When you deploy an application, you must make sure that users have correct versions of any required .bpls. |
Packages include the following parts: |
You can dynamically load packages by either:
|
When you compile from the command line, you can use the package-specific switches listed in the following table. Package-specific command-line compiler switches |
The $WEAKPACKAGEUNIT directive affects the way a .dcu file is stored in a package's .dcp and .bpl files. (For information about files generated by the compiler, see Package files created when compiling.) If {$WEAKPACKAGEUNIT ON} appears in a unit file, the compiler omits the unit from bpls when possible, and creates a non-packaged local copy of the unit when it is required by another application or package. A unit compiled with this directive is said to be weakly packaged. For example, suppose you've created a package called pack1 that contains only one unit, unit1. Suppose unit1 does not.. more |
Design-time packages simplify the tasks of distributing and installing custom components. Runtime packages, which are optional, offer several advantages over conventional programming. By compiling reused code into a runtime library, you can share it among applications. For example, all of your applications—including Delphi itself—can access standard components through packages. Since the applications don't have separate copies of the component library bound into their executables, the executables are much smaller, saving both system resources and hard disk storage. Moreover, packages allow faster compilation because only code unique to the application is compiled with each build. |