NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

modify data types

Using Test Stands DLL prototype adapter to call a shell interface DLL of my own creation, I have found an irritating problem with the data types loaded from my type library. Character arrays default to
Category: "Array of Numbers"
Type: �Signed 8-bit Integer�

I assumed that this would not be a problem as a character array is a character array number or string, the data is the same. However Test Stand is different. A char[] is not a char, and an error is reported If I try to pass a string variable to a char[] parameter type.
I can change the Category and Type however It would be nice If I could modify Test Stand type definition of a character array to ensure a char[] is resolved as:
Category: String
Type: C String Buffer

Any help will be grate
fully appreciated
Craig



Oh this is my function prototype:
//
// Function Name CallTest
//
unsigned long CallTest
(
[in] LPCTSTR Params,
[out] short *bIsSupported,
[out] char result[1024],
[out] char Resolved Params[1024],
[out] short *error Occurred,
[out] long *error Code,
[out] char error Msg[1024]
);
0 Kudos
Message 1 of 9
(5,891 Views)
Dear Craig,

May I ask you what language you have written the shell interface DLL in.

Also I would be grateful if you could attach the dll to your response if possible.

Many thanks

Louis Price
NIUK
Technical Support
0 Kudos
Message 2 of 9
(5,891 Views)
Craig -
Could you clarify what version of TestStand that you are using.

Scott Richardson (NI)
Scott Richardson
https://testeract.com
0 Kudos
Message 3 of 9
(5,891 Views)
Hi,
My exported DLL functions are written in 'C' with C++ class member functions.
I also have a .tlb to allow test stand version 3.0 the ability to list the function names and parameters.

I have attached both the DLL and tlb files

I don't have a problem with the function prototype information presenting itself in test stand.

The problem:
When the prototype is loaded (see attached jpg) "result", ResolvedParams, and errorMsg parameters are assumed to be an Array of 8 bit signed integers (by test stand, see parameter details section).

However I'm using the char array to get a string of characters from my DLL, so I have to check edit prototype and change the "Category" from array of numbers to string and change the "T
ype" to C String Buffer to stop test stand generating an error.

I call this function hundreds of separate times in a sequence. This makes developing a sequence a tedious job. If I could change something in Test Stands settings so when the prototype is loaded a char[] defaults to "Category" to string, and "Type" to C String Buffer.
0 Kudos
Message 4 of 9
(5,891 Views)
Craig -
TestStand's reading of a type library for the char[1024] case and interpreting it as a array of 8-bit integers is technically correct, but not typically correct. I have noted this internally to be looked at sometime in the future.

The LabWindows/CVI product generates a type library for its function panels and TestStand can read these. CVI adds attribute data that TestStand understands to help clarify how to interpret the intended use of the parameter.

If you want to pass a "C String Const" you can define the parameter in the IDL as:

[in] LPSTR cStringConstParam,

If you want to pass a "C String Buffer[1024]" you can define the parameter in the IDL as:

[in,
custom(53D57340-9A16-11d0-A62C-0020A
F16F78E, 1), /* Is Array? */
custom(746B27E2-FBD7-11d1-B311-060970535CB, "[1024]") /* ArrayBounds/BufferSize */
]LPSTR cStringBufferParam,

If you want to pass a "Array of Strings[10] of type C String Const" you can define the parameter in the IDL as:

[in,
custom(53D57340-9A16-11d0-A62C-0020AF16F78E, 1), /* Is Array? */
custom(746B27E2-FBD7-11d1-B311-0060970535CB, "[10]") /* ArrayBounds/BufferSize */
]LPSTR *charStarArray,


If you want to pass a "Array of Strings[10] of type C String Buffer[1024]" you can define the parameter in the IDL as:

[in,
custom(53D57340-9A16-11d0-A62C-0020AF16F78E, 1), /* Is Array? */
custom(746B27E2-FBD7-11d1-B311-0060970535CB, "[10][1024]") /* ArrayBounds/BufferSize */
]LPSTR charStarArray,


For unicode, just substitute LPWSTR for LPSTR. Also note that everything is passed as "[in]".

Look at the example on this page:

KnowledgeBase 1P68ATSR: How Do I Create a Type Library Using Visual C++?

Scott Richardson (NI)
Scott Richardson
https://testeract.com
Message 5 of 9
(5,891 Views)
Hi Scott,
I'm not a LabWindows/CVI customer, and the type libraries above don't seem to be on my PC. Will the above solution still work?
0 Kudos
Message 6 of 9
(5,891 Views)
The above will work. I was just pointing out that the answers that I gave you were based on support features between TestStand and LabWindows/CVI.

Scott Richardson (NI)
Scott Richardson
https://testeract.com
0 Kudos
Message 7 of 9
(5,891 Views)

Hi Scott,

 

Unless this an old thread from 2004 it is always actual today in 2009.

http://forums.ni.com/ni/board/message?board.id=330&message.id=25027&jump=true 

 

Thank you !

 

Juergen

 

 

EDIT:

Upper kowlege-link is broken !

try this in 2009 : http://digital.ni.com/public.nsf/3efedde4322fef19862567740067f3cc/604fdf48c4d9a687862567e5004eb90c?O...

Message Edited by j_dodek on 07-13-2009 03:25 PM
--Signature--
Sessions NI-Week 2017 2016
Feedback or kudos are welcome
0 Kudos
Message 8 of 9
(5,390 Views)

Hello,

 

I am creating a DLL in C that uses a .idl to export its functions to TestStand 2017. Most parameters are correctly converted and visible in the Module tab in TestStand.

 

Unfortunately, tTestData and tTestError fail to convert.

 

I have previously run into a similar error with two other parameters (including a table). This was solved using the following.

https://forums.ni.com/t5/NI-TestStand/modify-data-types/m-p/135973?query.id=802304#M4189

 

Those two "Custom values" I found on this forum for the specific types I was using made it so TestStand could read my function parameters.

[entry("")]          int MyFunction([in,custom(53D57340-9A16-11d0-A62C-0020AF16F78E, 1),custom(746B27E2-FBD7-11d1-B311-0060970535CB, "[256]")];

 

Do such custom values exist for types tTestData and tTestError ?

 

Any help would be great,

Clothilde

0 Kudos
Message 9 of 9
(2,217 Views)