String Parameters - C/C++ DLL Call Parameters
- Aktualisiert2025-07-21
- 2 Minute(n) Lesezeit
String Parameters - C/C++ DLL Call Parameters
String Parameters
When using string parameters, use the C String Buffer or Unicode String Buffer type when you want the function to be able to change the contents of the argument in TestStand. Use the C String or Unicode String type when the DLL function does not modify the argument. You can pass a literal string, a TestStand string property, or an expression that evaluates to a string as the value of a string parameter.
The following settings are available in the Data Type ring control when you select String for the category type.
| String Data Type Setting | Equivalent C Data Type |
| C String | const char * |
| C String Buffer | char[] |
| Unicode String | const wchar_t * or cont unsigned short * |
| Unicode String Buffer | wchar_t[] or unsigned shortp[] |
If you specify one of the string buffer types, the C/C++ DLL Adapter copies the contents of the string argument and a trailing zero element into a temporary buffer before calling the function. Specify the minimum size of the temporary buffer in the Buffer Size control. If the string value is longer than the buffer size you specify, the C/C++ DLL Adapter resizes the temporary buffer so it is large enough to hold contents of the string argument and the trailing zero element. After the DLL function returns, TestStand copies the value from the temporary buffer back to the string argument.
If you specify the C String or Unicode String type, the C/C++ DLL Adapter passes the address of the actual string directly to the function without copying it to a buffer. The code module must not change the contents of the string.