Example Legacy LabWindows/CVI Code Module
- Updated2025-07-23
- 1 minute(s) read
When you create a legacy code module for the LabWindows/CVI Adapter, you must add the stdtst.h header file located in the <TestStand Public>\AdapterSupport\CVI directory to the source file. The stdtst.h file includes the type definitions for the tTestData and tTestError structures.
The following is an example code module that uses the LabWindows/CVI standard prototype:
// Simple test example
#include "stdtst.h"
void TX_TEST __declspec(dllexport) FunctionName (tTestData *testData, tTestError *testError)
{
int error = 0;
double measurement = 5.0;
char *lastUserName = NULL;
testData->measurement = measurement;
if ((error = TS_PropertyGetValString (testData->seqContextCVI, NULL, "StationGlobals.TS.LastUserName", 0, &lastUserName)) < 0) goto Error;
Error:
// FREE RESOURCES
CA_FreeMemory(lastUserName);
// Set the error flag to cause a run-time error
if (error < 0)
{
testError->errorFlag = TRUE;
testError->errorCode = error;
testData->replaceStringFuncPtr(&testError->
errorMessage, "ErrorText");
}
}