Hydra 6: Import of interfaces from .Net assemblies fails

bugs://81812 got closed with status fixed.

Hello

I’ve fixed all 3 issues

@antonk,
thank you very much!
Is there a new beta available or must we contact support?

@bmaier

I can send you a new build now; what’s your username on remobhjects.com? We’ll probably have a new official beta, next week.

THANKS!!

a beta early next week works for us.
My user name is santiagoit

Thanks!

@bmaier

I’ve set you a new build now, to Personal Downloads.

yours,
marc

@mh,
I just tried the new build you uploaded for us.
It is much better now. :slight_smile:
However one error is happening:

The imported pas file looks like this:

  IHHCadLayer = interface(IHHCadObject)
  ['{...}']
    ...
  end;

  IHHCadObject = interface(IHYCrossPlatformInterface)
  ['{...}']
  end;

This generates a compiler error:

[dcc32 Error] Core_Import.pas(1899): E2086 Type ‘IHHCadObject’ is not yet completely defined

The fix is easy.
IHHCadObject must be defined BEFORE IHHCadLayer.

Thanks!

@bmaier

Thanks, logged as bugs://81842

Hmm, I guess I just need to list all interfaces in the very first lines of the interface section like

type
  IHHCadLayer = interface;
  IHHCadObject = interface;

This should be a more reliable and easy solution than sorting the interfaces.

EDIT: I see that the forward declarations should be created by the importer. Could you send to support@ your C# code for interface declarations and the resulting Delphi .pas file? All this code will be kept private ofc.

Thanks in advance

Also I have to add a very important note:

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

In COM interfaces can inherit from one another. However the .NET implementation (not Hydra but the framework itself) that exposes the .NET interface to COM does not support inheritance. Therefore you must replicate any interface members of the base interface in the derived interface.

More details at https://social.msdn.microsoft.com/Forums/vstudio/en-US/7313191a-10db-4a16-9cdd-de9fb80b378a/com-interop-base-class-properties-not-exposed-to-com?forum=csharpgeneral

@antonk,

yes I am aware of the limitation with COM interface inheritance in .NET. Thanks anyway. :slight_smile:

Correct, forward declarations are created by the importer. I tested and placed the forward declaration of IHHCadObject before the forward declaration of IHHCadLayer, but the error remains.

It is necessary that interfaces are completely defined (a forward declaration is not sufficient) before they can be used as a base interface.

Before upgrading to version 6, we had never run into this problem. We have been using Hydra for many years now. So I suspect you might already have some code in place to determine the definition order, which broke with version 6.

Since we do import a lot of .NET interfaces into Delphi using Hydra, I think it is rather unlikely that we have been so ‘lucky’ for all these years and all those interfaces were generated in the correct order.

Let me know if you still need the C# and the generated .pas file.

Thanks!

We recreated from scratch the importer for reasons of maintainability. So it seems some features were lost in the process.

It would be good to have them for testing purposes.

@antonk,
we have sent the file to your support channel.

bugs://81842 got closed with status fixed.

Great! :slight_smile:
Lets us know when a new beta containing the fixes is available so we can test.

Thanks!

Hello,

when will a new beta with the fixes become available?

Thanks!

By the end of this week (Island plugins are being reworked, so if we’d build Beta now they would be broken).

You can drop a mail to support@ with your remobjects.com account name and we’ll provide you a pre-Beta build

I’ve uploaded the latest build for you.

Hello,

we tested the latest beta: RemObjects Hydra - 6.1.0.1213 and importing the .NET interfaces is working fine again. :wink:

Thank you!

When will the next (non-beta) version be released?

1 Like