I'm just starting to learn more about how interfaces work, so it doesn't matter if this is a trivial question.
I have two plugins (name them A and B) as a DLL (not packages). There is an interface with a declared GUID in the application that loads the DLL, calls it IMyInterface. Both plugins see the same interface definition with the same GUID. Plugin B actually implements the interface.
Plugin A wants to know if Plugin B supports the IMyInterface interface. I am using obj.GetInterface (IMyInterface, IObj) to find out about this:
var IObj : IMyInterface; obj : TObject; obj := getPluginObjReference; if obj.GetInterface(IMyInterface, IObj) then showmessage ('Interface Supported');
If I name this code in plugin B, the answer will be yes, as expected. If I use the same code (cut and paste) in plugin A, the same code claims that plugin B does not support this interface. When I trace the GetInterface call in system.pas, I find that InterfaceEntry: = GetInterfaceEntry (IID); return nil, therefore, no interface to search.
For reference, IMyInterface looks like this:
IMyInterface = interface ['{277A3122-A3F2-4A14-AE56-C99230F31CE9}'] function getModel : AnsiString; function getDescription : AnsiString; end;
and the implementation is as follows:
// Now the real class, this is private to this plugin TModelAPI = class (TInterfacedObject, IMyInterface) function getModel : AnsiString; function getDescription : AnsiString; end;
and etc.
My question is:
As expected, plugin B rightly claims to be supported by IMyInterface. Why can't plugin A detect that plugin B supports IMyInterface? Is there a problem with polling interfaces across DLL boundaries?