NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I unload the DLLs that are used in a sequence file?

I have a device connected to the computer that gets a server name assigned to it (i.e. "Device_1"). Using the application that comes with the device, all devices get the same name "Device_1" as long as they are connected one at a time. In TestStand, as soon as I run the functions to connect/disconnect to this device, all subsequent devices are named "Device_2", "Device_3" and so on.
If I close TestStand, these subsequent devices are all named "Device_1" (again being connected one at a time).
 
It seems that TestStand still thinks that device one is still connected and increments the name.
 
I have tried a couple ActiveX calls in the process model, I get the sequence file object by calling the method GetSequenceFileEx from the Engine class, then call the method UnloadModules from the Sequence File class.
I get "True" as the return value which I believe means all modules were unloaded successfully, but I still get the device name being incremented until I close TestStand.
 
Does the SequenceFile.UnloadModules step unload all DLLs that are called from sub-sequences of the main sequence file?
 
Am I doing something wrong?  Is there another way to unload DLLs?
Thanks very much.
0 Kudos
Message 1 of 4
(3,441 Views)

Hi Tdot,

What you are doing is one method of unloading modules; however, there is an easier way. In your sequence file, you can easily change the Load and Unload options for your specific steps in the Properties menu under the Run Options tab. You can then set the DLL to unload after the step finishes executing. I would first try setting up your steps this way to see if this helps.

How are your devices being connected to your computer? For instance, are they are being connected via USB? By default, TestStand loads all of the DLLs when the sequence loads and unloads them at the conclusion of the sequence (unless you specify otherwise). Since TestStand is running these DLLs in process, even if TestStand is unloading the DLLs, it may not be losing the connection to (read: unloading) the driver you are using to communicate with your devices (for instance the driver to access the USB interface). This would explain why the device name continues to increment even after you unload the modules.

Matt M.
National Instruments

0 Kudos
Message 2 of 4
(3,421 Views)
Hi Matt,
I tried your suggestion but got the same result.
 
These devices are connected by ethernet. If the DLL I am calling is in turn calling a lower level ethernet driver, is it possible to unload that driver without knowning anything about it?
 
Thanks for you help.
Tyler
0 Kudos
Message 3 of 4
(3,410 Views)
Hey Tyler,
 
Any unloading of lower-level dll's such as drivers should be done from within the applications that you using them.  For instance, if you call a module that uses a GPIB driver, the module should close any references to that GPIB driver before completing execution.
Thanks,

Andy McRorie
NI R&D
0 Kudos
Message 4 of 4
(3,392 Views)