NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

reloading dll

hey all,

I am using teststand 4.0 and want to do the following and hope it is possible:

I have a sequence that uses c/c++ adapter and uses a compiled dll, I have several stations and I want to make sure that they all use the most recent dll.

I need in each sequence that I run to verify that the dll is the latest (against a file that that is shared) and if not reload the dll and start the sequence.

obviously I need to put the necessary  steps in the model file(I am planning on just comparing the dll file’s date and if it is not updated copy the new on over the old),

problem is how do I run over the old dll if the seqEdit.exe uses it.

 

thanks

mosh

0 Kudos
Message 1 of 5
(3,385 Views)

Because multiple steps might have the module loaded, the most practical thing you can do is just unload them all by using Engine.UnloadAllModules(). You can individually unload modules for particular steps using Step.UnloadModule(), but if multiple steps use the same dll you would have to do this for all of them in order for the dll to get unloaded.

 

Hope this helps,

-Doug

0 Kudos
Message 2 of 5
(3,370 Views)

helps,

but will  the Engine.UnloadAllModules() release the the dll file for editing and runnig over?

thanks

mosh

0 Kudos
Message 3 of 5
(3,364 Views)

Hi Mosh,

 

Unloading a module completely frees it from TestStand, allowing overwriting of the file, as well as editing the source code and recompiling it.  

 

You may also want to consider setting the unload option on your dll call steps to unload after sequence executes, which will unload only the module in question, rather than all modules.  

 

1.png

 

Keeping modules loaded in TestStand allows the sequence to run faster on subsequent executions, since the code is already in memory.  It may be easier to just unload all modules as Doug suggested, depending on your application.

Al B.
Staff Software Engineer - TestStand
CTA/CLD
0 Kudos
Message 4 of 5
(3,331 Views)

I'd also add that you shouldn't unload a module after a step executes if that module stores anything in static or global variables that you want to keep around since those will be reinitialized if your dll is unloaded and reloaded.

 

-Doug

0 Kudos
Message 5 of 5
(3,324 Views)