Home arrow Delphi-Kylix arrow Page 2 - Plug-ins Explained
DELPHI-KYLIX

Plug-ins Explained


In this first part of a two-part article about Delphi Packages, we are going to discuss what packages are, and how they can aid in designing plug-ins for Delphi applications. We will also look at the disadvantages and advantages of creating a plug-in with Delphi Packages compared to DLLs. I'd like to send a word of thanks to the chaps on the Delphi news groups who pointed me in the right direction and made helpful suggestions.

Author Info:
By: Leidago
Rating: 5 stars5 stars5 stars5 stars5 stars / 5
November 13, 2006
TABLE OF CONTENTS:
  1. · Plug-ins Explained
  2. · Building your own packages
  3. · Linking your package
  4. · An example

print this article
SEARCH DEVARTICLES

TOOLS YOU CAN USE

advertisement
Plug-ins Explained - Building your own packages
(Page 2 of 4 )

Creating a package is surprisingly easy. Go to File|New|Other and select Package from the object repository:

Once you've clicked on the packages icon, you should see the following screen:

The package editor enables you to add and remove units to and from the package. It is always good to save the package in its own folder, to keep the generated files together. Before you compile a package, make sure that the output directory points to the same directory where you want to save the package. You do this by opening up the Project Options dialog box, by clicking on the options button, selecting the "Directory/Conditional" ta,b and then entering the directory location. When you compile the package it will create DCP, DCU and BPL files, which you want to have in the same location, especially if you are going to use them to create plug-ins.

As you can see from the package editor, the editor has two lists:

  • Contain: The "contains" clause is responsible for listing all the units that the package will contain. You add units to the package by clicking on the "Add" button.
  • Requires: In Delphi 7, the required run-time package is VCL70.dcp. This is required in case your units use anything from the VCL. The package editor will automatically add the required VCL according to what is needed by the units listed in the "Contain" clause.

To avoid using the VCL twice in your application, make sure that you built your application using the VCL run-time packages.

When you create, save or compile a package, a couple of files are generated. So let' s look at these files:

  • .DPK  - Contains the package source code.
  • .DCU - Binary image for a unit file contained in the package.  One DCU file is  created for each unit file.
  • DCP -  Links with the run-time package.
  • .BPL - The file that you will need to deploy with your application.

To finish building a package, simply compile the package and a .bpl will be created and stored in the directory that you specified. If you did not specify an output directory, the .bpl file will be put in the DelphinProjectsBPL directory.


blog comments powered by Disqus
DELPHI-KYLIX ARTICLES

- Loading an XML Document into the DOM
- Delphi Wrapper Classes and XML
- Delphi and the DOM
- Delphi and XML
- Internet Access: Client Service
- Finishing the Client for an Internet Access ...
- The Client for an Internet Access Control Ap...
- User Management for an Internet Access Contr...
- Important Procedures for an Internet Access ...
- Server Code for an Internet Access Control A...
- Constructing the Interface for an Internet A...
- Building a Server Application for an Interne...
- Building an Internet Access Control Applicat...
- Client Dataset: Working with Data Packets an...
- Using the Client Dataset in an N-Tiered Appl...

Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 



© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 9 - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials