Enumeration Parameters - C/C++ DLL Call Parameters
- Aktualisiert2025-07-21
- 3 Minute(n) Lesezeit
Enumeration Parameters - C/C++ DLL Call Parameters
Enumeration Parameters
You can pass enumerations you create as named data types. When you create or edit an enumeration data type, you can specify whether the type can be a C structure argument and how the type represents itself in memory when you pass it to a structure parameter or array parameter.
The following settings are available in the Data Type ring control when you select Enumeration for the category type.
| Numeric Data Type Setting | Equivalent C Data Type |
| Signed 8-bit Integer | char |
| Unsigned 8-bit Integer | unsigned char |
| Signed 16-bit Integer | short |
| Unsigned 16-bit Integer | unsigned short |
| Signed 32-bit Integer | long |
| Unsigned 32-bit Integer | unsigned long |
| Signed 64-bit Integer | long long, __int64 |
| Unsigned 64-bit Integer | unsigned long long, unsigned __int64 |
| 32-bit Real Number | float |
| 64-bit Real Number | double |
Enum Type
When you select the Enumeration category for a parameter, the C/C++ Adapter displays the Enum Type control. This control allows you to specify the Enumeration data type necessary for the parameter in the Value Expression control. Additionally, the Value Expression control becomes a combo box where you can select enumerators of the enumeration. You can also enter an enumeration name or the corresponding numeric value for the enumeration directly into the Value Expression or Function Call controls.
When you select an Enumeration parameter that accepts an enumerated type from a code module that has a type library, TestStand will automatically check if the Enumeration data type and the type library enumeration have exactly matching enumerators. If not, then the Enum Type chosen will be shown in red with a warning message regarding the detected mismatch.
Pass by Value or by Reference
When you select the Enumeration category for a parameter, the C/C++ DLL Adapter displays the Pass control. which specifies whether TestStand passes the value of the argument you specify in the Value Expression control or passes a pointer to the argument. If you select By Pointer (*) or By Reference (&) , the adapter passes a pointer to the argument value.
If you choose to pass a pointer, the argument you specify in the Value Expression control must be the name of a variable or property. When you select the Enumeration category for the return value, you may leave the Value control empty or specify the name of a variable or property.
Result Actions
The C/C++ DLL Adapter displays the Result Action ring control and the Set Error.Code to Value option for return values and parameters you pass by pointer. Depending on the settings of these controls, TestStand can automatically set the Error.Occurred and Error.Code properties of the step according to the value in the enumeration argument when the function returns.
Use the Result Action ring control to configure TestStand to set the Error.Occurred property to True when the return value or parameter value after the call is greater than zero, less than zero, equal to zero, or not equal to zero. Use the Set Error.Code to Value option to request TestStand to assign the output value of the argument to the Error.Code property.