# Visual Studio imported interface problems

**URL:** https://talk.remobjects.com/t/visual-studio-imported-interface-problems/31359
**Category:** Hydra
**Created:** [February 4, 2025, 2:17pm UTC](https://talk.remobjects.com/t/visual-studio-imported-interface-problems/31359 "2025-02-04T14:17:10Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![mjtrainor](https://talk.remobjects.com/letter_avatar_proxy/v4/letter/m/94ad74/32.png) [@mjtrainor](https://talk.remobjects.com/u/mjtrainor)
#### Post date: [February 4, 2025, 2:17pm UTC](https://talk.remobjects.com/t/visual-studio-imported-interface-problems/31359/1 "2025-02-04T14:17:10Z")

</div>

As before: Registered Hydra 6.7.0.1345, Delphi 11, Visual Studio 2022 17.12.4

.NET8 with a test project created from the VS2022 wizard. Non visual plugin only

I have imported a Delphi interface to VS2022 in a Framework project, then copied the imported .cs to the .Net8 project, but there seem to be some problems. First off the import:

> // Imported cross-patform Hydra plugin interfaces  
> // Some interfaces may not be imported or imported incorrectly due to the following issues:  
> // [51:8] CloseRound expected  
> //
> 
> namespace HydraTest  
> {  
> [System.Runtime.InteropServices.GuidAttribute(“d372b43d-a36a-48f2-81f4-90e5008b74aa”)]  
> public interface IPointCloudFilterInterface : RemObjects.Hydra.CrossPlatform.IHYCrossPlatformInterface  
> {  
> Integer TestValue();  
> }  
> }

I did some searching here but can’t figure out what the CloseRound expected message means. (During a later import while writing this message, the comment with CloseRound went away).

FYI, the comment has a a typo and says cross-patform instead of cross-platform.

Second, on Integer TestValue() Integer is unknown. I’m guess there needs to be a using, but alt-enter on Integer doesn’t give me any choices beyond creating my own type. I worked around it for now by changing it to int.

Where I’m stuck right now is I have a test C# library with the Delphi import unit in it, and I’ve created a new plugin in that library, but the Mixed Mode C# sample doesn’t show (or I can’t find where it does) how to reference the interface the import created from Delphi with the plugin, or how to create an instance of it so I can use it.

Can you give me or point me to a simple example of instancing a Delphi non-visual plugin in C#?

---

<div class="post-metadata">

### Author: ![EvgenyK](https://talk.remobjects.com/user_avatar/talk.remobjects.com/evgenyk/32/16_2.png) [@EvgenyK](https://talk.remobjects.com/u/EvgenyK)
#### Post date: [February 4, 2025, 2:43pm UTC](https://talk.remobjects.com/t/visual-studio-imported-interface-problems/31359/2 "2025-02-04T14:43:51Z")

</div>

Hi,

can you show your delphi interface, pls?

---

<div class="post-metadata">

### Author: ![mjtrainor](https://talk.remobjects.com/letter_avatar_proxy/v4/letter/m/94ad74/32.png) [@mjtrainor](https://talk.remobjects.com/u/mjtrainor)
#### Post date: [February 4, 2025, 2:58pm UTC](https://talk.remobjects.com/t/visual-studio-imported-interface-problems/31359/3 "2025-02-04T14:58:06Z")

</div>

```
[System.Runtime.InteropServices.GuidAttribute("d372b43d-a36a-48f2-81f4-90e5008b74aa")]
public interface IPointCloudFilterInterface : RemObjects.Hydra.CrossPlatform.IHYCrossPlatformInterface
{
    int TestValue();
}

```

}

---

<div class="post-metadata">

### Author: ![EvgenyK](https://talk.remobjects.com/user_avatar/talk.remobjects.com/evgenyk/32/16_2.png) [@EvgenyK](https://talk.remobjects.com/u/EvgenyK)
#### Post date: [February 4, 2025, 3:05pm UTC](https://talk.remobjects.com/t/visual-studio-imported-interface-problems/31359/4 "2025-02-04T15:05:46Z")

</div>

> [@mjtrainor](#):
>
> ```auto
> [System.Runtime.InteropServices.GuidAttribute("d372b43d-a36a-48f2-81f4-90e5008b74aa")]
> public interface IPointCloudFilterInterface : RemObjects.Hydra.CrossPlatform.IHYCrossPlatformInterface
> {
> int TestValue();
> }
> 
> ```

I mean original **delphi** interface (.pas file).

---

<div class="post-metadata">

### Author: ![mjtrainor](https://talk.remobjects.com/letter_avatar_proxy/v4/letter/m/94ad74/32.png) [@mjtrainor](https://talk.remobjects.com/u/mjtrainor)
#### Post date: [February 4, 2025, 3:11pm UTC](https://talk.remobjects.com/t/visual-studio-imported-interface-problems/31359/5 "2025-02-04T15:11:37Z")

</div>

[PCFInterfaces.pas](https://talk.remobjects.com/uploads/short-url/jMPF8Sxicgc7hQhrF2QvOW7G3wp.pas) (273 Bytes)  
[NonVisualPlugin.pas](https://talk.remobjects.com/uploads/short-url/3hjjlSNPn3aECn99B8w6erY5Krm.pas) (1.7 KB)  
[hcNPL2Controller.pas](https://talk.remobjects.com/uploads/short-url/jwAsFLy2Kef96TCqfz5h23AKL9k.pas) (2.2 KB)

---

<div class="post-metadata">

### Author: ![EvgenyK](https://talk.remobjects.com/user_avatar/talk.remobjects.com/evgenyk/32/16_2.png) [@EvgenyK](https://talk.remobjects.com/u/EvgenyK)
#### Post date: [February 4, 2025, 3:25pm UTC](https://talk.remobjects.com/t/visual-studio-imported-interface-problems/31359/6 "2025-02-04T15:25:37Z")

</div>

Hi,

> [@mjtrainor](#):
>
> // [51:8] CloseRound expected

I can’t reproduce this error

> [@mjtrainor](#):
>
> Second, on Integer TestValue() Integer is unknown. I’m guess there needs to be a using, but alt-enter on Integer doesn’t give me any choices beyond creating my own type. I worked around it for now by changing it to int.

I’ll review why it uses `Integer` instead of `int` type.  
we have table that describes Delphi and .NET types at [https://docs.hydra4.com/HowTos/PassingInterfacesBetweenHostAndPlugins](https://docs.hydra4.com/HowTos/PassingInterfacesBetweenHostAndPlugins) .

> [@mjtrainor](#):
>
> Can you give me or point me to a simple example of instancing a Delphi non-visual plugin in C#?

review this sample: [testcase.zip](https://talk.remobjects.com/uploads/short-url/1oY48QFYgdkXISrtpgmWgmdzlcB.zip) (19.7 KB)

---

<div class="post-metadata">

### Author: ![mjtrainor](https://talk.remobjects.com/letter_avatar_proxy/v4/letter/m/94ad74/32.png) [@mjtrainor](https://talk.remobjects.com/u/mjtrainor)
#### Post date: [February 4, 2025, 4:33pm UTC](https://talk.remobjects.com/t/visual-studio-imported-interface-problems/31359/7 "2025-02-04T16:33:48Z")

</div>

I’ve made some progress, through searching the forums here, but I had to make changes for it to run and I’m not getting the response I should. Maybe you can assist:

```
public static class Program
{
    [STAThread]
    public static void Main(string[] args_)
    {
        var moduleManager = new ModuleManager();
        var module = moduleManager.LoadModule(@"c:\temp\NPL2\Win32\Debug\NPL2.DLL");

        var plugIns = moduleManager.Plugins.ToArray();
        foreach (var plugin in plugIns)
        {
            Console.WriteLine($"{plugin.Description} {plugin.Name} {plugin.UserData}");
        }

        var inst = moduleManager.CreateInstance("PointCloudFilterInterfaceTest");

        if (inst is IPointCloudFilterInterface test)
        {
            Console.WriteLine($"{test.TestValue()}");
        }
    }
}

```

To make it work (and maybe it’s the cause of the wrong value), I had to change the Delphi side interface to inherit from IHYCrossPlatformPlugin instead of IHYCrossPlatformInterface.

TestValue() should return 42, it’s hard coded in Delphi, but I’m getting zero.

---

<div class="post-metadata">

### Author: ![EvgenyK](https://talk.remobjects.com/user_avatar/talk.remobjects.com/evgenyk/32/16_2.png) [@EvgenyK](https://talk.remobjects.com/u/EvgenyK)
#### Post date: [February 5, 2025, 7:30am UTC](https://talk.remobjects.com/t/visual-studio-imported-interface-problems/31359/8 "2025-02-05T07:30:57Z")

</div>

Hi,

> [@mjtrainor](#):
>
> TestValue() should return 42, it’s hard coded in Delphi, but I’m getting zero.

these declarations work as expected:

```auto
  IPointCloudFilterInterface = interface(IHYCrossPlatformInterface)
  ['{D372B43D-A36A-48F2-81F4-90E5008B74AA}']
    function TestValue : Integer; safecall;
  end;

```

```auto
    [System.Runtime.InteropServices.GuidAttribute("d372b43d-a36a-48f2-81f4-90e5008b74aa")]
    public interface IPointCloudFilterInterface : RemObjects.Hydra.CrossPlatform.IHYCrossPlatformInterface
    {
        int TestValue();
    }

```

[testcase2.zip](https://talk.remobjects.com/uploads/short-url/47D7Lh0kGakwCQapTF7pXbmueVX.zip) (19.4 KB)
