Inherited interfaces from .net dll

(Phillip Watson) #1

I have a .net dll (Simple.Interfaces) that contains interface definitions for various entities.
An example is

public interface ICustomer, IPerson, IEntity

ICustomer declares customer specific properties and IPerson declares general person properties like name etc
This .net dll (Simple.Interfaces) has no reference to any Hydra interfaces and has no other dependencies, the interfaces do not have Guid attributes and the .dll is not com visible.

I want to create a .net non visual plugin that I can then import in to Delphi. The interfaces declared in the plugin are as follows. My idea is to create a “wrapper” interface that implements the IHYCrossPlatformInterface as required but also the ICustomer interface.

public interface ICustomerHydra : IHYCrossPlatformInterface, ICustomer

The plugin project has a reference to the first .net dll (Simple.Interfaces) and hence can use ICustomer from that dll.
When I import the plugin in to Delphi it only imports an empty ICustomerHydra interface with no properties inherited from ICustomer. It looks like it is trying because the auto generated import module is referencing another import module in it’s uses that is named like the Simple_Interfaces_Import but that unit does not exist. It has not actually been generated. As shown

uHYCrossPlatformInterfaces, Simple_Interfaces_Import;
ICustomerHydra = interface;

// Original Name: Module.Interfaces.ICustomerHydra
ICustomerHydra = interface(IHYCrossPlatformInterface)

Is there a way of having the import use the properties inherited from ICustomer, IPerson or will I have to manually maintain the ICustomerHydra and declare the accumulated properties from ICustomer and IPerson explicitly?
I have tried decorating the ICustomer interface in Simple.Interfaces with a Guid attribute and making it com visible but that didn’t help any. I got exactly the same generated import unit.
Is the importer not capable of generating code that uses the multiple interfaces? Why is it failing to generate Simple_Interfaces_Import if that is the problem?
Is there something I need to do to make it work as I want?
Using Hydra 5, Visual Studio 2017, Delphi XE6.
Please advise.


(antonk) #3


In case of Delphi <-> .NET communications Hydra actually uses COM.

In COM interfaces can inherit from one another. However the .NET implementation that exposes the .NET interface to COM does not support inheritance. Therefore you must replicate any interface members in a base interface to the derived interface.

More details at


(Phillip Watson) #4

Okay, thanks for your help and clarification will implement the properties explicitly on the hydra interface.