LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Sharing a DLL Reference for different loops

Hi,

I have a custom DLL which communicates with an FPGA over raw ethernet. I wrote it in C# and  want to to use it in my LabView VI. I want to have at least 3 loops, one for GUI, one for sending data to device, one for receiving data from device. I use queue for passing data between GUI and other loops. If I open a DLL and use it in GUI loop how can I use the "same" DLL in other loops, I mean How can I share the same reference to other loops?

0 Kudos
Message 1 of 5
(3,037 Views)
That happens automatically. You can only have one copy of a DLL loaded, so all calls to that DLL will go to the same place. Make sure you know whether your DLL functions are thread-safe, and configure the call library function node appropriately.
0 Kudos
Message 2 of 5
(3,017 Views)
Oh, wait... By DLL, do you actually mean a .NET assembly? If so, and you want to share the same .NET objects, then you need to share the wires somehow (either open the objects before the loops start and fork the wires, or use queues, notified, etc to pass the objects).
0 Kudos
Message 3 of 5
(3,014 Views)

That was my question exactly, thanks dor answer. Yes it is NET Assembly,

I created a constactor node outside of the loops and I connected the reference to all loops.

 But I am not sure  how to synchronize them. If a loop causes an error what happens to reference and error outputs?

0 Kudos
Message 4 of 5
(3,011 Views)

@kahlenberg wrote:

 But I am not sure  how to synchronize them. If a loop causes an error what happens to reference and error outputs?


Depends on the error. If the object reference remains valid (for example, a .NET method threw an exception such as a timeout) it will have no effect on other calls to that object, as far as LabVIEW is concerned. LabVIEW will catch the exception, convert it to an error on the error wire, and proceed normally. If the error somehow invalidates the reference (for example, destroys the object, although I don't know how or if this could occur), then you'll get an error when you attempt to perform further actions on that object (such as later in a different loop).

0 Kudos
Message 5 of 5
(2,997 Views)