I have projects where I create multiple sequence files that call a DLL with C or extern C'd C++ code. Each project has a unique DLL. Once the sequence execution starts the DLL is loaded ( preload since that's the default ) and the DLL isn't unloaded until the sequence file is closed ( again default behavior ).
What I'd like to do is the following:
* Be able to reset all global/static global variables in the DLL between executions
* Be able to run the top level or any subsequence independently
* Be able to run any sequence multiple times
I've considered the following solutions:
* Change each sequence to unload after execution --> potential downfall if someone forgets to change the setting on a new sequence
* Add a function call to the DLL with some generic name and a step in a/all the process model sequence(s) to call and the function would call functions in each module to reset the static variables --> potential downfall if you forget one variable
* Update some known callback to do an UnloadAllModules --> have to change many sequences, possible to miss one
* Add a RunState.Engine.UnloadAllModules call to the process model sequence --> so far I can't get this to work. I added it before the PreUUTCallback inside the UUT Loop ( SequentialModel ). That way, each execution would be unloaded. This doesn't seem to work and I think it's because the UnloadAllModules wants to unload the station model as well and it can't be unloaded since it's to be used and/or because it's in use when that step is called.
Does anyone have another thought on how to do that helps mitigate the concerns? I can write the code to guard against variables not being cleared, can force a clear for some variables, and hope if all goes well that this is a mute concern but in reality you want to know the state of values at program start. This is a function of the DLL being loaded and multiple executions potentially being run before the DLL is unloaded.
Thanks.
-G-