NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Definition of Result Struct

Thank you for the link. I will look into it. Meanwhile the questions I have are:

1- Is there any limitations which prevent me from using the error struct in a VC++ DLL and TestStand?

2- Can it be done as easily as with the CVI adaptor?
0 Kudos
Message 11 of 16
(1,621 Views)
After using the debugging techniques described in the knowledge base document I have found the following:

I simplified my code to do only the following:

        errorStruct->errorCode = kRelayReadBackMismatch;  //kRelayReadBackMismatch is defined as -1 in the code

Where errorStruct should be pointing to the actual Test Error container of the step (thats what I want).

When I call the dll I get an error code 0 (not the same as the one I had before, I'll try to reproduce the old one as well).

I get those exceptions:

irst-chance exception in SeqEdit.exe (KERNEL32.DLL): 0xE06D7363: Microsoft C++ Exception.
First-chance exception in SeqEdit.exe (KERNEL32.DLL): 0xE06D7363: Microsoft C++ Exception.
First-chance exception in SeqEdit.exe (KERNEL32.DLL): 0xE06D7363: Microsoft C++ Exception.
First-chance exception in SeqEdit.exe (KERNEL32.DLL): 0xE06D7363: Microsoft C++ Exception.
First-chance exception in SeqEdit.exe (KERNEL32.DLL): 0xE06D7363: Microsoft C++ Exception.
WARNING!!! 'No entry for errorCode' Line 251 in function TEErrorToRString in file C:\TestStand_Autobuild\Build31\Src\Shared\TEFwk\TEError.cpp

Now I dont have the source for TS unfortunately 😉 So maybe I just mislabled the elements of the error struct (I used the CVI container directly from the CVI .h)

Is there any header available for VC++ 6.0?

We're getting pretty close to the problem!

Thanks,

Louis
0 Kudos
Message 12 of 16
(1,620 Views)
I've had a look at the TS examples (PassingSequenceContextToMFCDLL). I guess that could be an alternative if nobody knows how to pass an entire Error struct to the dll.
0 Kudos
Message 13 of 16
(1,620 Views)
TiWi -
The struct "tTestError" was a definition that was used in code modules that the LabWindows/CVI Testexec Toolkit called.  The Error data type in TestStand is a new definition for holding error information for a TestStand step.  The Error data type cannot be mapped to the tTestError struct because the tTestError definition has fields that the Error data type does not have.
 
I believe that you intend to allow the code module to set the error status of a step.  So you would want to pass in the Error property of the step to the DLL, but you must create an equivalent and matching struct in VC to accept this:
typedef struct TSStepError_Rec
    {
    int           errorCode; 
    char *        errorMessage; // [1024]
    int           errorOccurred;   
    } tTSStepError;

void __declspec(dllexport) openAllTrunks(tTSStepError *stepErrorStruct);
The alternative is to use a prototype that passes all the elements separately:
void __declspec(dllexport) openAllTrunks(short *errorOccurred,  long *errorCode,  char errorMsg[1024]);
Hope this helps...
Scott Richardson
0 Kudos
Message 14 of 16
(1,615 Views)
Great thank you it works!

Just two questions to wrap this up:

1- When passing the Error data type to my dll, I am passing it as a pointer using Category: C Struct and Type: Error, is that correct?

2- If I ever need the definition of other standard data types for C++ were are they available?

Thanks!
0 Kudos
Message 15 of 16
(1,608 Views)

TiWi -
Your specification for (1) sounds correct. For (2), I assume that you are talking about C structs defined for Windows SDK?  There is no "source" for existing datatypes for these types of structs.  You must create your own data type and determine the correct data type mapping yourself.  Just keep the name of the data type unique so that it will not collide with data types that others might create and share with you.

Scott Richardson
0 Kudos
Message 16 of 16
(1,603 Views)