Home arrow Delphi-Kylix arrow Page 3 - 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 - Linking your package
(Page 3 of 4 )

After you've created your package, the next step is to link it to your main application. You can link your run-time packages in two ways, statically or dynamically. When using static linking, you simply add the names of the Pascal files to the "uses" clause of your application. Don't worry about the same units being listed in your package. By adding these units you ensure that the VCL is used when you eventually run the application. When you run your application with statically linked packages, it ensures that the run-time packages are present.

If the run-time packages are not present, an error will be generated and program execution will be stopped. Now, keep in mind that our overall aim is to use packages as an plug-in, so this situation will not do. Static linking also won't work for use because you will need to re-link the package to the application when you change the package's contents or replace it with another package. This pretty much takes away the independence of the core application when used with packages. This basically means that every time you change something in the package, you will need to recompile the core application to which it needs to be linked. It is for this reason that static linking is not suitable for our purposes at all. So let's take a look at dynamic linking.

If you've ever used DLL files in your applications, you should not have any problems working with dynamic packages, because they work pretty much in the same way. Dynamic packages are basically a "special" type of DLL that works only with Delphi applications. So, why are dynamic packages suitable to use for creating plug-ins? 

  • You can update the package without crashing the core application.
  • All the relevant VCL functionality is stored in the package, which allows for a smaller executable.
  • You load the package when the main application starts without crashing it, because you can add code to check whether or not the package is available.
  • You can load and unload the package(s) as and when you need them as opposed to a statically linked package that has to be linked no matter what.

It is the flexibility to load and unload a package that is of particular interest to us, because that is how we are going to manage our plug-ins.


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 11 - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials