How to Store Size_t Data in TestStand Variables

Updated Nov 29, 2018

Reported In

Software

  • TestStand

Issue Details

I have a DLL that utilizes a size_t datatype variable. I want to be able to pass the data to both 32-bit and 64-bit TestStand. However, it appears the 32-bit version of TestStand recognizes size_t data as a float and the 64-bit version recognizes the data as an unsigned 64-bit integer. How can I create a variable in TestStand that can handle the size_t datatype without having to change the numeric representation of all of my TestStand variables?

Solution

The size_t datatype does not have a direct equivalent in TestStand. Therefore, you cannot pass out a value from a function in a DLL and store it directly into a numeric variable in TestStand without setting the representation of the variable to Double Precision 64-bit Floating-Point in 32-bit TestStand or Unsigned 64-bit Integer in 64-bit TestStand.

Instead, you can define the function in your DLL to pass a pointer to your variable but still return the actual value of the variable. In TestStand, you can then set the Return Value type from your function to Pointer/Handle and store the variable in an Object Reference Variable. The screenshot below highlights where to define these settings in the parameters of your DLL in TestStand.



You can then retrieve the value of that Object Reference variable by inputting the expression below into an expression step. Note: This code will work on both 32-bit and 64-bit TestStand if Locals.Int64Number is a Signed 64-bit Integer, however only the low order 32-bits of the integer will be used on 32-bit TestStand.

Locals.Int64Number = (&Locals.objectRefVariable).AsPropertyObject.GetValInteger64("", PropOption_Coerce)

The value of your size_t data will then be stored in Locals.Int64Number and can be used as a regular 64-bit signed integer.
 

Additional Information

Example sequence files and DLL's for both 32-bit and 64-bit TestStand are included in the zip file in the Attachments section of this article to further demonstrate the solution outlined above.

Attachments

WAS THIS ARTICLE HELPFUL?

Not Helpful