To answer your question Nandini, I don't get any compile error but I
get a runtime error -17502; System Level Exception. when I run one of
the functions from my dll with one of the parameters being the error
struct. I am using the C++ adapter for my C++ dll and I defined the
tTestError struct in VC++.
Scott do you mean setting the Default struct packing to 8 byte in
TestStand? That is already done. Is there anything that must be defined
in VC++ as well?
What I have already done and works is a CVI callback to which I
automatically pass the error struct of the step, so whenever there is
an error in my dll (a Telnet client) the error code and string are
automatically passed back to TS and they are displayed in the report. I
took a screenshot of how the step is passing the parameters to the dll.
Is there any way to do the same thing with the C++ adapter?
Here is the C++ dll header:
#include <string.h>
typedef int tErrLoc; /* No longer used but included
for backwards compatibility */
typedef int Boolean;
#ifndef FALSE
#define FALSE 0
#endif
#ifndef TRUE
#define TRUE 1
#endif
typedef struct ClassError_Rec
{
Boolean
errorFlag; /* The test function
must set this to TRUE if an error occurs. */
tErrLoc
errorLocation; /* No longer used, but included for
backwards compatibility. */
int
errorCode; /*
The test function may set this to a non-zero value if
an */
/* error
occurs.
*/
char *
errorMessage; /* The test function may set this to a
descriptive string if */
/* an error
occurs.
*/
} tTestError;
void __declspec(dllexport) openAllTrunks(tTestError *errorStruct);
void __declspec(dllexport) closeAllTrunks(tTestError *errorStruct);
void __declspec(dllexport) openTrunk(int TrunkNumber, tTestError *errorStruct);
void __declspec(dllexport) closeTrunk(int TrunkNumber, tTestError *errorStruct);
void openPort(unsigned long BaseAddress, unsigned char RelayAddress, tTestError *errorStruct);
void closePort(unsigned long BaseAddress, unsigned char RelayAddress, tTestError *errorStruct);
void findCards(void);
I am calling either one of the 4 function that are exposed to the dll.
Is there any way for TestStand to automatically assign the current
step's errorStruct to the errorStruct parameter?
I tried removing the errorStruct parameter, setting the struct
parameters values inside the functions and calling those functions and
they work as expected.