views:

318

answers:

1

Hi,

I have to create a plugin in Delphi Prism for Application that is already in Delphi. I have read all about Hydra 3.0 in www.remobjects.com and have some queries.

  1. Can you please give me an example how to create custom Interfaces for communication between Delphi Host and .Net Plugin.(either in C# or Delphi Prism)

  2. what is the role of ModuleController in Hydra plugin and how it works there?

  3. Role of Manager Component?

Many Thanks in Advance.

+1  A: 

I'm just starting out on the "Hydra" journey myself but I'll do my best to answer your questions.

Q1. This one is hard to answer without some more info about your situation. Do you have access to the Delphi code base? Are you adding a plugin to an existing application that already has plugins, or are you just starting to add the Hydra plugin framework to your application? For now I'll guess that you are adding a new plugin to an existing host application and you have the .pas file containing the custom interfaces you are going to use for your communications between the host and your plugin. If that's the case then the following should work for you.

  • You need to start a new "RemObjects Hydar" -> "Plugin Module" project in Visual Studio.
  • Import the .pas file that contains the communication interfaces by going "Tools" -> "Hydra" -> "Import Interfaces from Delphi Unit"
  • Add a new "RemObjects Hydra" -> "(Non-)Visual Plugin" item to your project
  • Add the interface to your new plugin class and implement the interface's methods.

That should be about it. Your Host application will now be able to query your plugin to see which interface(s) it implements and then call the methods it requires.

This is something like what your imported interface file should look like

type
  {$REGION Attributes}
  [Guid('9D445B3E-CA9F-4C67-815A-F5EC6BAB5D60')]
  {$ENDREGION}
  IMyInterface = public interface(IHYCrossPlatformInterface)
    method MyMethod(const MyInput: String; out MyOutput: String);
  end;

This is something like what your plugin class should look like

type
  [Plugin, NonVisualPlugin]
  MyPlugin = public partial class(RemObjects.Hydra.NonVisualPlugin, IMyInterface)
  private
  protected
    method Dispose(aDisposing: boolean); override;
    method MyMethod(const MyInput: String; out MyOutput: String);
  public
    constructor;
  end;

Q2. As far as I know the module control is responsible for registering all the plugins in your plugin module with the host application. You can also use it from your plugin(s) to communicate with the host application.

Q3. I assume you are referring to the THYModuleManager. This is used (among other things) to load all your plugins at runtime.

Hope that helps.

Cheers,

Nick

toomeke