Heh!
Heh!
Interface woes this time :)
I got this quite simple code:
procedure TClientPluginInterfaceList.Add(APlugin: IPlugin);
var Item : TClientPluginItem;
begin
Item := TClientPluginItem.Create;
Item.Priority := APlugin.Priority;
Item.Plugin := APlugin;
FPluginList.Add( Item );
end;
When I assign the priority from the interface, the interface's Execute method is called and I have no idea why.
This is Delphi XE.
The interface looks like so:
IPlugin = interface
['{0EF2AF6A-1D4B-4306-8E5C-C5991C504F40}']
function GetCaption : String;
function GetDescription : String;
function GetPriority: Integer;
procedure Execute;
property Caption : String read GetCaption;
property Description : String read GetDescription;
property Priority: Integer read GetPriority;
end;
When I assign "Priority", then "Execute" is called and the plugin shows even though it should not.
Have you ever seen such a madness before?
Any ideas what's going on?
Thanks!
A
Interface woes this time :)
I got this quite simple code:
procedure TClientPluginInterfaceList.Add(APlugin: IPlugin);
var Item : TClientPluginItem;
begin
Item := TClientPluginItem.Create;
Item.Priority := APlugin.Priority;
Item.Plugin := APlugin;
FPluginList.Add( Item );
end;
When I assign the priority from the interface, the interface's Execute method is called and I have no idea why.
This is Delphi XE.
The interface looks like so:
IPlugin = interface
['{0EF2AF6A-1D4B-4306-8E5C-C5991C504F40}']
function GetCaption : String;
function GetDescription : String;
function GetPriority: Integer;
procedure Execute;
property Caption : String read GetCaption;
property Description : String read GetDescription;
property Priority: Integer read GetPriority;
end;
When I assign "Priority", then "Execute" is called and the plugin shows even though it should not.
Have you ever seen such a madness before?
Any ideas what's going on?
Thanks!
A
Such issues are possible if you have changed interface definition and you have application/dlls compiled with different interface definition
ReplyDeleteimho you have two, different definition of IPlugin interface
ReplyDeleteRight. I checked and there is just one definition. I also explicitly clean and rebuild all packages at every change.
ReplyDeleteI also have one dcp but had TWO core.bpl files (I checked because originally I had 2 versions of the dcp as well). I now have one. I also realised one of the two plugins was in fact using the other version and this was causing all sorts of issues. Heh. Happy now :D
Welcome to DLL hell.
ReplyDeleteHeh, still better than COM. I hate COM.
ReplyDeletewhat does SetPriority in TClientPluginItem do?
ReplyDeleteNo SetPriority. It's read-only. But it was a duplicate package.
ReplyDeleteWhere is the implementation of IPlugin?
ReplyDeleteWhat is called in the GetPriority function?