11-06-2011 11:18 AM - edited 11-06-2011 11:18 AM
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
11-07-2011 09:34 AM
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
11-08-2011 07:57 AM
helps,
but will the Engine.UnloadAllModules() release the the dll file for editing and runnig over?
thanks
mosh
11-10-2011 01:11 AM - edited 11-10-2011 01:12 AM
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.
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.
11-10-2011 09:56 AM
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