title: How to find out if an object supports a given interface (between two DLLs)
body: <p>I am just starting to get more familiar with how interfaces work so bear with me if this is a trivial question.</p>
  
  <p>I have two plugins (call them A and B) in the form of DLLs (not packages). There is an interface with a GUID declared in application that loads the DLL, call it IMyInterface. Both plugins see the same interface definition with the same GUID. Plugin B actually implements the interface. </p>
  
  <p>Plugin A wants to find out if plugin B supports the interface IMyInterface. I use obj.GetInterface (IMyInterface, IObj) to find this out: </p>
  
  <pre><code>var IObj : IMyInterface;
      obj : TObject;
  
  obj := getPluginObjReference;
  
  if obj.GetInterface(IMyInterface, IObj) then
     showmessage ('Interface Supported');
  </code></pre>
  
  <p>If I call this code within plugin B, the answer is yes, which is as expected. If I use the same code (cut and paste) in plugin A, the same code claims that plugin B does not support that interface. When I trace the GetInterface call into system.pas I find that InterfaceEntry := GetInterfaceEntry(IID); return nil, hence no interface to find.</p>
  
  <p>For reference, IMyInterface looks like:</p>
  
  <pre><code>IMyInterface = interface
  ['{277A3122-A3F2-4A14-AE56-C99230F31CE9}']
     function getModel : AnsiString;
     function getDescription : AnsiString;
  end;
  </code></pre>
  
  <p>and the implementation looks like:</p>
  
  <pre><code>// Now the real class, this is private to this plugin
  TModelAPI = class (TInterfacedObject, IMyInterface)
     function getModel : AnsiString;
     function getDescription : AnsiString;
  end;
  </code></pre>
  
  <p>etc.</p>
  
  <p>My question:</p>
  
  <p>As expected plugin B rightly claims that IMyInterface is supported. Why is it that Plugin A cannot discover that plugin B supports IMyInterface? Is there a problem with interrogating interfaces across DLL boundaries? </p>