01-27-2007 03:19 AM
02-14-2007 11:59 PM
You can use the dll entry point DLL_PROCESS_DETACH in your DLL which is executed each time teststand unloads your DLL. See also http://msdn2.microsoft.com/en-us/library/ms682583.aspx
In Teststand you can define when your DLL should be unloaded in the Step Properties of your C/C++ Prototype Adapter -> Run Options -> Unload Options. The Dll is also unloaded if Teststand shuts down.
If you use CVI you can insert the code needed with:
Edit->Insert Construct ->DLLMain
This is what you get:
#include <cvirte.h>
int __stdcall DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
switch (fdwReason)
{
case DLL_PROCESS_ATTACH:
if (InitCVIRTE (hinstDLL, 0, 0) == 0)
return 0; /* out of memory */
break;
case DLL_PROCESS_DETACH:
//here you can enter your clean up code: FreeLibrary(..)
CloseCVIRTE ();
break;
}
return 1;
}
02-25-2007 02:44 AM
02-25-2007 11:59 PM
Ok, I see.
Do you know the TestStand API function TS_ExecutionInitTerminationMonitor and TS_GetTerminationMonitorStatus?
You can use these functions in your DLL to find out if a TestStand execution is terminating/terminated.
Hope this helps.