LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

labview dll in Visual Studio 2015

Hi ,

I am using labview dll using labview runtime 2013 in visual studio 2012 and it works fine.
When I am using same dll with visual studio 2015 it doesn't work.

Could someone help me on this.

Thanks,
Abhishek

0 Kudos
Message 1 of 8
(4,783 Views)

Hey Shake007, 

 

How exactly did you go about creating the .dll you are using?  Are you receiving any particular error code or do you just not have the desired functionality?

 

Matt | NI Systems Engineering
0 Kudos
Message 2 of 8
(4,728 Views)

Hi Matt,

Thanks for your reply.

 

We have created dll using LabView 2013 as a .Net Interop assembly.

On .net side when we use dll it shows we cannot convert double[] to  double[*]. 

I know that Measurement studio doesn't support Visual Studio 2015. Is there any connection between them.

 

Thanks,

Abhishek 

0 Kudos
Message 3 of 8
(4,720 Views)

There are a few reasons why that may not work.  Do you still have the older VS 2013 install on the computer?  Does the RTE match the version of LabVIEW where the .dll was built? 

 

Likely the error is within some configuration setting for the build.  It may be worth verifying that the .dll actually works through some other means, like calling it with a call library function node.  

Matt | NI Systems Engineering
0 Kudos
Message 4 of 8
(4,703 Views)

Since the LabVIEW DLL was actually created as a .Net assembly, the Call Library Node will not be able to access anything.

 

What is most likely the problem here, is a mismatch of the .Net CLR version between what the LabVIEW assembly is set to use and what your Visual C program is configured for.

 

Around LabVIEW 2012 or 2013 the default .Net runtime version was changed from 2.5 to 4.0. These two can not coexist and are also usually not compatible.

 

The most simple solution is to actually set the Visual C project to also use .Net CLR 4.0 if you use a LabVIEW 2013 or newer .Net assembly.

 

Another potential problem could be the bitness. Unlike .Net assemblies created in C# where the entire code is translated into a .Net bytecode assembly that is actually target platform independent, LabVIEW .Net assemblies contain the compiled machine code for the target platform that was used to create it. LabVIEW creates wrappers that make these functions accessible through .Net but the underlaying code only supports the platform of the LabVIEW version used to create it (x86 32 bit or x64 64 bit code). Accordingly the resulting .Net assembly can only be loaded in an application that is running in the same platform subsystem.

 

That means if you used LabVIEW 32 bit to create the assembly you can only access it from a .Net executable build as a 32 bit process. The same is true for a LabVIEW 64 bit created assembly that can only be accessed from an application set to build as 64 bit process.

Rolf Kalbermatter
My Blog
0 Kudos
Message 5 of 8
(4,693 Views)

The most simple solution is to actually set the Visual C project to also use .Net CLR 4.0 if you use a LabVIEW 2013 or newer .Net assembly.

 

This seems to be the issue, because I see the below mentioned issue in my application.

 

The primary reference "Find" could not be resolved because it has an indirect dependency on the .NET Framework assembly "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" which has a higher version "4.0.0.0" than the version "2.0.0.0" in the current target framework. 

 

Then I tried setting .Net CLR 4.0, also .Net framework 4.6.1. I still see the error 
Error CS1503 Argument 1: cannot convert from 'double[]' to 'double[*]' ConsoleApplication1 

 

Any suggestions appreciated. Thank you.

0 Kudos
Message 6 of 8
(4,648 Views)

Looks like that error is just what it says - that Visual Studio is unable to convert the data type of one argument to something that the method can understand.  Here's a little more information about a closely-related error (Error CS1502):

 

https://msdn.microsoft.com/en-us/library/b66k5sz9.aspx

 

The article also goes into various ways to resolve the error.  Looks like your best option is to track down the invalid argument and use the Convert class to switch it to the proper type. 

Matt | NI Systems Engineering
0 Kudos
Message 7 of 8
(4,631 Views)
0 Kudos
Message 8 of 8
(4,172 Views)