11-08-2006 02:50 PM
char test[] = {0xFD,0x37,0x00};
to my dll function whose prototype is function(char* test_str); the problem is that I cannot create a char array in teststand. How to do create one or any work around.
11-09-2006 09:46 AM
When using string parameters, use the C String Buffer or Unicode String Buffer type if you want the function to be able to change the contents of the argument in TestStand. Use the C String or Unicode String type if 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 that 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 that the function writes into 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.
![]() |
Note You can pass NULL to a String pointer parameter by passing an empty object reference or the constant Nothing. Do not pass the constant 0. |
11-09-2006 10:11 AM
Yes, you could pass a string. You can even encode byte values in the string with escape codes.
Another option, which might be mandatory if your byte array contains embedded zeros, is to define a numeric array where each element is a value that fits in a byte (0 to 255). Then pass the array as an array of bytes (numeric array of signed or unsigned 8 bit integers).
For the array argument, I think you could even pass an array literal such as {1,2,3,4} or {0x1, 0x2, 0x3, 0x4}. For the dimension size, I think you can pass -1 to mean "the number of elements in the array argument I passed".
- James
04-15-2007 09:25 AM
04-16-2007 03:55 PM
Hi paulbin,
Have you tested it out? If so what issues are you seeing?
Regards,