Quantcast
Channel: DIAdem topics
Viewing all articles
Browse latest Browse all 3197

Help integrating .NET dll through LabView calls

$
0
0

I'll preface this with saying this is my first time trying to call Labview VI's from DIAdem, and more specifically, ones that are calling a DLL.

 

Ultimately, I will be using a much more complex DLL, but just to get my feet wet, I created a very simple calculator DLL.

 

I have a .dll that was created with C# targeting the .NET Framework 4.7 (I also tried building targeting .NET 4). I've created a Labview project containing this DLL and two simple VI's. One VI is some simple mathmatical operations to test my DIAdem calls to Labview with a simple VI and the other contains code to call the DLL. The VI calling the DLL uses the Constructor Node to create a reference to the DLL and then an Invoke Node to call the methods in the DLL, see image below.

Interface_Screenshot.png

 

In LabView, the "Interface.vi" VI runs just fine and calls the DLL as expected.

 

Then I tried running the same VI by calling it through DIAdem and I get the following error:

DIAdemError.png

 

Please see the attached script (TestInterface.VBS) that I am using to load the VI. Basically, I'm initiallizing the LVRuntime and then using LVRuntime.LoadVI. I read in the help, that to use a VI created in LabView with the Runtime environment, you need to build a Source Distribution, so I built one that includes the DLL and both VI's in the Labview project. However, when I try to run the script, the same error occurs. Then I tried loading the other VI that does not call a DLL ("SimpleTest.vi") and the script runs as expected for that VI (regardless if I'm using the raw VI or the source distribution).

 

Additionally, I found a DIAdem example that calls a VI to integrate an external DLL ("Integrating an External DLL to Calculate Prime Numbers"). I called my script to load the VI from that example ("LVR_Calc_Primes.vi") and my script works just fine. I'm assuming that since that VI is using a "Call Library Function Node" that the DLL was compiled from C++ and not C#.

 

The other difference I noticed is that the example VI and DLL are located in the DIAdem program directory, while my calculator VI and DLL are located on a network drive. 

 

So I'm not sure if I'm doing something wrong, or if there is a different method of calling .NET dll's from DIAdem. I've attached the C# source code, LabView project and VI's, DLL and DIAdem script. Any help or tips would be more than welcomed! Thanks.


Viewing all articles
Browse latest Browse all 3197

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>