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

Comments

  1. Such issues are possible if you have changed interface definition and you have application/dlls compiled with different interface definition

    ReplyDelete
  2. imho you have two, different definition of IPlugin interface

    ReplyDelete
  3. Right. I checked and there is just one definition. I also explicitly clean and rebuild all packages at every change.

    I 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

    ReplyDelete
  4. Heh, still better than COM. I hate COM.

    ReplyDelete
  5. what does SetPriority in TClientPluginItem do?

    ReplyDelete
  6. No SetPriority. It's read-only. But it was a duplicate package.

    ReplyDelete
  7. Where is the implementation of IPlugin?
    What is called in the GetPriority function?

    ReplyDelete

Post a Comment