• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 759
  • Last Modified:

how to Create plugin in delphi

Hi Experts,

I know the plugin is also a type of DLL but I have a few queries on this

1. I would like to know the basic difference between DLL and plugin?
2. Is COM based DLL can be created as plugin (Example Google Tool Bar in Internet Explorer)?
    If so how application identifies this plugin, as this is third party component?
3. How to create plugin using regular DLL concepts. How Application identifies the
    plugin functionalities?How to bind plugin to application? How to make the plugin to identify
    application objects (forms and thier sub components)?
4. And finally I want a code examples with detailed explaination.

Thanks and Regards
  • 6
3 Solutions

> And finally I want a code examples with detailed explaination.

Nothing more? <g> Ok, I'll try to explain as wide as I can.

I'll be speaking here of *DELPHI* and plug-ins, thus - even though most of what I'll say is
applicable to other environments as well, it's wholly applicable only to Delphi.

-Difference between Plug-in and Add-in:

The main difference between the two is simply that an ADD-IN is simply ADDED, no
registration with the main app is usually necessary.
A plug-in, instead, usually requires it.

There're several different kinds of plug-ins that can be created with Delphi:

1) DLL plug-ins
2) COM plug-ins
3) Package plug-ins
4) UDP Plug-ins
5) IPC Plug-ins

You have most probably heard about the first 3 kinds, but not the last 2 <g>.
This is because they're VERY rare and not much used due to their incommodity
during development and usage, especially IPC ones.

So, we'll focus on the most common ones: the first 3.


Advantages: Can be written in ANY language supporting DLL creation
Disadvantages: are routine-based, thus can be quite difficult to manage, in case
special needs are in place.


Advantages: Can be written in ANY language supporting COM servers.
                   They use an OO approach, so that it's easier to manage them and
                   their configuration is extremely easy
Disadvantages: They only support OLEVariant types, thus no custom Delphi classes,
                       unless you use custom marshalling, which is *awful*.


Advantages: Are fully OO compliant, can import custom Delphi classes and at the
                  same time are true DLLs, so while it can be a plugin for an application,
                  the same package can also be plain DLL for another app - which is
                  quite a good thing :-)
                 They support all Delphi's predefined and CUSTOM types with NO variants.
Disadvantages: Plug-ins can only be written in Delphi, of course.

Now, this is a small piece of code showing you more or less how a plug-in framework should
look like:

      TPluginBase = class( TPersistent )
     TPluginMenuInfo = class( TPlugInBase )
          function GetPosition : Integer;virtual;abstract;
        property ItemCaption : String;
        property MenuCaption : String;
        property Position : Integer read GetPosition;
    TPluginCommand  = class( TPluginBase )
      FMenuInfo : TPlugInMenuInfo;
      function CreateMenuInfo : TPlugInMenuInfo;
      procedure Execute;virtual;abstract;

   TPlugInCollection = class( TPlugInBase )
      function GetPlugIn( Index : Integer ) : TPlugInCommand;
      procedure AddPlugIn( Plg : TPluginCommand );
      procedure DelPlugIn( Plg : TPluginCommand );
      property PlugIns[ Index : Integer ] : TPlugInCommand read GetPlugIn;

This is, more or less, how a plug-in framework should be layed out.

For further inspection of this topic, please have a look at GetClass, FindClass,
LoadPackage and TClass.


Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

lots on plugins :)
I still prefer the interfaced approach

I suggest you to go through this link

http://www.chami.com/tips/delphi/011097D.html This is initail step to write a plugin. Helps alot



Good Articles List on dlls
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Train for your Pen Testing Engineer Certification

Enroll today in this bundle of courses to gain experience in the logistics of pen testing, Linux fundamentals, vulnerability assessments, detecting live systems, and more! This series, valued at $3,000, is free for Premium members, Team Accounts, and Qualified Experts.

  • 6
Tackle projects and never again get stuck behind a technical roadblock.
Join Now