How to Pass TestStand Container with Enumerated Type as a C Struct?

Updated Mar 3, 2025

Reported In

Software

  • TestStand

Issue Details

I have a TestStand container with two properties - a number and an enum type:

enter image description here

I want to pass this container as a C Struct to my DLL. Assume DLL uses 1-byte packing.

My number layout is 32-bit signed:

enter image description here

However, my enumerated type can only be stored as Embedded Struct:

enter image description here

How to pass this struct to my DLL, specifically what should be the C Struct definition?

enter image description here

Solution

Follow the steps below:

  1. Enable struct passing for the Enumeration itself. It is there that you set the numeric type that the Enumeration corresponds to.
  2. Enable struct passing for the container and specify "Embedded Struct" for the Enumeration. This should cause the bits of the int (in your case) to be passed within the structure. (It seems a little weird, but an Enumeration is a named type. You will get similar behavior if you create a named Number and add it to your Container.)

Please confirm that the struct packing comes out correctly by inspecting the data within a C code module. You will want to set the value of the Enum to something like 0xdeadcafe to make sure the entire 32 bits are in the right place.