Need a Jumpstart with Delphi XE3 and .NET 2.0 DLL Assemblies Integration

Hello

Let’s go step by step:

I have a VM with VS 2013 and RAD Studio XE 2 and a freshly installed Hydra

1.Plugin
1.1.Create a new project using provided C# template “Plugin Module”
1.2.Add a new non-visual plugin using the ‘Add New Item’ menu, set its name to SomePlugin
1.3.Add a new interface to the project:

using System.Runtime.InteropServices;
using RemObjects.Hydra.CrossPlatform;

namespace TestPlugin
{
    [Guid("974D7C5E-13B8-41F7-B617-CB857CD648D5")]
    public interface ISomePlugin : IHYCrossPlatformInterface
    {
        void Foo();
        string Bar(int value);
    }
}

Guid was generated via Visual Studio’s Tools menu
1.4.Implement this interface in the class added at step (1.2),
1.5.Set RemObjects.Hydra reference’s property Copy Local to true
1.4.Build the plugin

2.Host app
2.1.Create a new Delphi app using template ‘RemObjects Hydra’ -> ‘Host Application’ as described here http://docs.hydra4.com/Hosts/VCLHost/
2.2. Then execute menu command ‘Hydra’ -> ‘Import Interfaces from .NET Assemblies’
2.3. Select assembly built at step 1.4
2.4. Import the ISomePlugin interface
2.5. Open the MainForm again
2.6. Add handlers for the event OnCreate and OnDestroy (you’ll have to change the path to the plugin dll):

type
  TMainForm = class(TForm)
    HYModuleManager1: THYModuleManager;
    procedure FormCreate(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
    fPlugin: IHYNonVisualPlugin;
  public
    { Public declarations }
  end;

var
  MainForm: TMainForm;

implementation

{$R *.dfm}

procedure TMainForm.FormCreate(Sender: TObject);
begin
  self.HYModuleManager1.LoadModule('c:\123\TestPlugin\TestPlugin\bin\Debug\TestPlugin.dll');
  self.HYModuleManager1.CreateNonVisualPlugin('TestPlugin.SomePlugin', fPlugin);
end;

procedure TMainForm.FormDestroy(Sender: TObject);
begin
  self.HYModuleManager1.ReleaseInstance(fPlugin);
  self.HYModuleManager1.UnloadModules();
end;

end.

2.7.Add a button to the main form and handle its OnClick event:

procedure TMainForm.Button1Click(Sender: TObject);
begin
  with fPlugin as ISomePlugin do begin
    Foo();
    MessageDlg(Bar(42),mtCustom, [mbOk], 0);
  end;
end;

Run the host app, press the button and it will execute 2 methods of your .NET plugin