C Struct Passing Tab - Type Properties Dialog Box

C Struct Passing Tab

You can use the C/C++ DLL Adapter or LabWindows/CVI Adapter to pass a TestStand variable or property to a structure parameter in a code module function. The data type of the variable or property you pass must contain all fields the structure parameter expects. If a data type contains a subproperty that is a named data type, you must also allow objects of the named data type to be passed as a structure.

There are several ways to format data type fields in the in-memory representation of a structure parameter. Use the C Struct Passing tab to specify how TestStand formats an instance of a data type you pass as a structure in memory.

The C Struct Passing tab can contain the following options:

  • Allow Objects of this Type to be Passed as Structs —Passes instances of the data type to structure parameters.
  • Packing —Select the Packing option according to the development environment and compiler settings you use to create the DLLs you call.

    Microsoft Visual C++ and Symantec C++ have a default of 8-byte packing. LabVIEW, Borland C++ and Watcom C++ have a default of 1-byte packing. For LabWindows/CVI, the default packing can be either 8- or 1-byte, depending upon the compatibility mode. For example, in Visual C++ compatibility mode, LabWindows/CVI has a default of 8-byte packing. Configure this option for all data types that specify Default Adapter Packing in the C/C++ DLL Adapter Configuration or LabWindows/CVI Adapter Configuration dialog boxes.

  • Property —Use this ring control to select a subproperty of the data type in order to specify the in-memory format of the subproperty. You can also configure the in-memory format for a data type subproperty in the Variable Properties dialog box for the subproperty.

    If a subproperty of the data type is a named type, the Property control does not include the subproperties of the type in the ring control. You must separately configure the named data type to allow the C/C++ DLL Adapter to pass objects of the named type as a structure, and specify the structure elements to map.

  • Exclude when Passing Structure —When you enable this option, TestStand does not include the selected subproperty in the in-memory representation of the data type.
  • Type —The data type of the selected subproperty.
  • Numeric Type —Specifies whether the numeric property is a real, signed, or unsigned integer. It also specifies whether the numeric property is 8-, 16-, 32-, or 64-bit.
  • String Type —Specifies whether a pointer to string references a C-string, unicode string, C-string buffer, or unicode string buffer.
  • Store Array as —Visible for array subproperties only. This control contains the following options:
    • Embedded Array —The array resides within the in-memory representation of the data type.
    • Pointer To Array —A pointer to the array resides within the in-memory representation of the data type. The C/C++ DLL and LabWindows/CVI Adapters cannot call functions that specify structure fields that contain pointers to memory which the function allocates or deallocates.
    • LabVIEW Array —The struct member is a LabVIEW array.
  • Store Struct as —Visible for container subproperties only. This control contains the following options:
    • Embedded Struct —The structure representation of the container property resides within the in-memory representation of the data type.
    • Pointer To Struct —A pointer to the structure representation of the container property resides within the in-memory representation of the data type. The C/C++ DLL and LabWindows/CVI Adapters cannot call functions that specify structure fields that contain pointers to memory which the function allocates or deallocates.
  • String Buffer Size —Visible for string subproperties only. The maximum size of an inline or buffered string.
  • Store String as —Visible for string subproperties only. This control contains the following options:
    • Inline String —The struct member is an array of characters.
    • Pointer to String —The struct member is a pointer to an array of characters. The C/C++ DLL and LabWindows/CVI Adapters cannot call functions that specify structure fields that contain pointers to memory which the function allocates or deallocates.
    • LabVIEW String —The struct member is a LabVIEW string.
  • < Type Ring > —Specifies how to format the subproperty in memory. The choices vary according to the subproperty type and are the same as the data passing options you specify for parameters on the Module tab of the Step Settings pane for the C/C++ DLL and LabWindows/CVI Adapters or in the Edit DLL Module Call or Edit LabWindows/CVI Module Call dialog boxes.

See Also

C/C++ DLL Adapter Configuration dialog box

Edit DLL Module Call dialog box

Edit LabWindows/CVI Module Call dialog box

LabWindows/CVI Adapter Configuration dialog box