LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem Using Labview Applications With Same DLL

Hi,
 
I have two Labview VI's that use an external DLL that I have written to do some read/writes over a special network interface.  Both VIs use the same exact DLL.  When run as VIs, they both appear to function properly and can be run at the same time.
 
However, I need to build them into two separate Labview applications and need to be able to run both at the same time.  When I try to do this, the DLL for the second application I run does not appear to work.  Has anyone seen problems like this before?
 
I suspect this is happening because when they are built as applications the DLL is included in each application's own "data" directory, thus giving two copies of the same DLL.  I am guessing that when I run the second application, there is a problem loading the DLL because it is already in memory from the first application that I ran.  When run as VIs, I've noticed that the first VI loads the DLL and the second VI automatically uses the one that is already in memory.  This does not appear to occur when using the Labview applications.  Does this hypothesis make sense to anyone?  Any suggestions how to get around this?
 
I would appreciate any suggestions about how to get around this and still be able to use two Labview applications that can be run at the same time.
 
Thanks,
 
Brian
0 Kudos
Message 1 of 2
(2,400 Views)
btuman,
I have two suggestions for potentially getting around the problem you are seeing. The overall idea would be to have a copy dll for each application so that each has its own instance of our dll. The first way to do this would be for you to literally create a copy of the dll on your hard drive and rename it. Then point your one of you Call Library Interface nodes to the copy. Make sure to add the new name to the support files for your installer.
 
The second method would be to make the dll reentrant. To do this, double click on your call library function nodes and change "run in UI thread" to Reentrant. This will effectively create a copy of your dll in memory so that each application has its own instance of the dll.
 
Post back to let us know if this worked.
 
Best Regards,
 
Chris C
Applications Engineering
National Instruments
0 Kudos
Message 2 of 2
(2,380 Views)