Let’s rephrase your question to ‘Can my plugin call a method on the host?’.
Sure. Such calls are the main purpose of Hydra.
Here is a sample, that will show you interop calls in action: HostEventTriggering.zip
This sample contains a Delphi host and .NET plugin.
To run this sample build both host and plugin projects. Then run the NewHostApplication.exe. Press the Load Plugin button to load .NET plugin. Then press the Send Event button to call a host Delphi method from .NET plugin.
Let’s take a closer look at the host app code:
uCustomInterfaces.pas file contains 2 interop interfaces.
fMain.pas file contains code
HYModuleManager1.CreateVisualPlugin('ManagedModule.Plugin1', fPlugin, Panel1);
(fPlugin as IInterfaceThatHasEvents).SetEventSink(Self);
Here a plugin is loaded from dll. Then this plugin is instantiated and then a method of this plugin is called.
In the plugin code we can see
private ImyInterfaceEvents fEventSink;
public void SetEventSink(ImyInterfaceEvents Sink)
fEventSink = Sink;
private void button1_Click(object sender, EventArgs e)
if (fEventSink != null)
As you can see the 1st method is called from the host size. The 2nd method in this code snippet in its turn calls a method in callback interface provided earlier by the host. Essentially it calls a method in the host.
Note that implementation is not tied to a plugin or host having a form. In this sample
VisualPlugin is used only to provide a simple way to start a
Plugin-> Host method call operation. This approach can as well be used for non-visual plugins.