Array Parameters - C/C++ DLL Call Parameters
- Updated2025-07-21
- 2 minute(s) read
Array Parameters - C/C++ DLL Call Parameters
Array Parameters
When you select the Array of Numbers, Array of Strings, Array of Enumerations, Array of Objects, Array of Booleans, or Array of C Structs categories for a parameter, the adapter displays controls similar to what it shows for the Numeric, String, Enumeration, Object, Boolean, or C Struct categories. You can specify an array that contains elements of the specified type. TestStand reformats and copies the contents of the array arguments into a temporary array containing elements that have the data type you select.
Use the Dimensions and Dim N Size controls to specify the number of dimensions and the number of elements in each dimension of the temporary array.
One-Dimensional Arrays
For one-dimensional arrays in which the array argument has fewer elements than the temporary array, the C/C++ DLL Adapter fills the remaining elements in the temporary array with zeros. When the array argument has more elements than the temporary array, TestStand fills the temporary array with the maximum number of elements that can fit.
For one-dimensional arrays in which you want the number of elements in the temporary array to always match the number of elements in the array argument, specify a negative value in the Dim N Size control. This specification is equivalent to the following expression:
GetNumElements (arrayArgument)
If you specify a zero value in the Dim N Size control, TestStand passes the address of the temporary array with no elements to the DLL function. When the DLL function returns, TestStand cannot fill the contents of the array argument with the contents of the temporary array because the array size is zero.
For one-dimensional arrays, when the array argument has fewer elements than the temporary array, TestStand stores only the number of elements from the temporary array that fit into the array argument. When the array argument has more elements than the temporary array, TestStand stores all the elements of the temporary array in the array argument and makes no changes to the remaining elements of the array argument.
Multi-Dimensional Arrays
For multi-dimensional arrays, the dimension sizes of the array argument must match the specified number of elements in the Dim N Size control.
If you select the Array of C Structs category, the C/C++ DLL Adapter displays the Element Pass control. When you select Embedded Element , TestStand creates an array of C structures and passes the array to the DLL function. When you select Pointer to Element , TestStand creates an array of C structures and passes the array of pointers to the DLL function.
See Also
Accessing Arrays Using API from LabWindows/CVI Code Modules (Example)