LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LabView .Net Interop and Arrays

Hi, we are also using array's of double (Foo) in Labview generated dll, and ran into the same problem when building in VS2015 and referencing the dll.

 

VS2015

Error CS0570 'Foo' is not supported by the language.

 

I installed VS2015 update 1, and instead I get this error.

Error CS0029 Cannot implicitly convert type 'double[*]' to 'double[]'

 

Message 11 of 17
(1,975 Views)

Hi Magnux,

 

Yes, the VS2015 update makes VS to recognize the array properly, now the problem is on LabView, that is doing an multidimension array from a single dimension array. 

 

No idea that this is going to change in the near future, I have contacted NI support, and this was their answer:

The way LabVIEW handles arrays is not anything that can easily be changed and
it would most probably have severe implications. The LabVIEW part is not
broken, it just treats a  one dimensional array as a multidimensional array of
rank one, and this is causing the latest version of VS to misinterpret the data
type.

 

The best for you ( and what I did, is to get the workarround). make labview use multi-dimension arrays so you can send and receive arrays from labview, then use as multidimensions in VS2015.

Message 12 of 17
(1,962 Views)

Thanks JOSEALB85, we'll look into using your suggested workaround!

 

Is there an official support ticket for this issue that I can upvote? 🙂

Otherwise, I'll try to post a new ticket to NI support regarding the array problem. 

 

Merry Christmas!

/Magnus

0 Kudos
Message 13 of 17
(1,947 Views)

Yes, I have been exchanging emails with Anton Sundqvist, and the support reference is Reference#7440462.

Maybe if we add some pressure they will fix it some day.

0 Kudos
Message 14 of 17
(1,943 Views)

Thanks, we have now also added a ticket with a reference to yours as well.

 

0 Kudos
Message 15 of 17
(1,924 Views)

Hello,

I am getting this same error while passing an array from C# to a LabVIEW Interop assembly. Has anyone found a solution or fix to this?

 

The Interop signature looks like this

void CFit(Array Input__32Array, out Array Output__32Array, out Array Result__32Array)

When I try to pass an array VS2015 throws an error: 

Error CS1503 Argument 1: cannot convert from 'Reflex_UI.iData[]' to 'Reflex.CFit.Input__32Array__32[]*

 

IData is defined in C# with the following 

[StructLayout(LayoutKind.Sequential, Pack = 0)]
public class IData
{
    [MarshalAs(UnmanagedType.R4)]
    public float L;
    [MarshalAs(UnmanagedType.I4)]
    public int D;
    [MarshalAs(UnmanagedType.R4)]
    public float S;
    [MarshalAs(UnmanagedType.I2)]
    public short I;
    [MarshalAs(UnmanagedType.I2)]
    public short C;
}

Thanks in advance.

0 Kudos
Message 16 of 17
(1,192 Views)

Looks like we have to make change on LabVIEW side.

 

Please check the link below.

https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z0000019LNISA2

 

0 Kudos
Message 17 of 17
(1,096 Views)