How I do this is to implement the interface in the plugin and call it from the host, for example.
MyApp.Interfaces.pas
uses
Classes;
type
IMyPluginInterface = interface
['{C0436F76-6824-45E7-8819-414AB8F39E19}']
function ConvertToUpperCase(const Value: String): String;
end;
implmentation
end.
Plugin:
uses
..., MyApp.Interfaces;
type
TMyPluginDemo = class(TJvPlugIn, IMyPluginInterface)
public
function ConvertToUpperCase(const Value: String): String;
...
implmentation
function TMyPluginDemo.ConvertToUpperCase(const Value: String): String;
begin
Result := UpperCase(Value);
end;
...
Host:
uses
..., MyApp.Interfaces;
...
function TMyHostApp.GetPluginUpperCase(Plugin: TjvPlugin; const Value: String): String;
var
MyPluginInterface: IMyPluginInterface;
begin
if Supports(Plugin, IMyPluginInterface, MyPluginInterface) then
Result := MyPluginInterface.ConvertToUpperCase(Value)
else
raise Exception.Create('Plugin does not support IMyPluginInterface');
end;
Hope this helps.
source
share