NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

passing array of strings from Teststand to LV dll

Solved!
Go to solution

Hello,

 

I am wondering, why is it not possible to pass an 1D string array from TestStand to a dll, which is compiled with LabView. Passing the PropertyObject works fine, but as the parameter category "Array of Strings" exists on the TestStand dll call pane, it should be possible to pass an array directly. I get an empty dialog, where I attempt to display the contents of the directly passed array.

 

Why is it not working???

 

TS_dll_settings.jpgLV dll to be called.jpg

0 Kudos
Message 1 of 13
(5,602 Views)

Perhaps because you have the teststand step configured to pass 2 parameters, but the vi is only expecting 1? What is the prototype of the function exported from the labview created dll?

 

-Doug

0 Kudos
Message 2 of 13
(5,598 Views)

Hi Doug,

 

the prototype is correct:

void __stdcall _StringsAndBools(IDispatch *PropObj_StringArray, TD1Hdl *strings);

 

But I have also tried the same function wit a single argument, only one array of strings. It does not work. It would be cool, if you could provide a simple example which is working.

 

cheers

Madottati

0 Kudos
Message 3 of 13
(5,590 Views)

Hi,

 

is the LabVIEW VI running? Can you try to use the error cluster to debug the VI, to give us a feedback if there are any error messages?

0 Kudos
Message 4 of 13
(5,563 Views)

Hi Frank,

 

for the bottom code, where the input string array will be displayed, there is no error cluster. There is no function with error output.

 

For the top code it would be possible, but that is working - so it would not make sense.

 

LV is not running, as I compiled it to a dll...

 

Madottati

0 Kudos
Message 5 of 13
(5,558 Views)

Hi Madottati,

 

Can you try to locate the position on wich the string is passed wrong? Is it an error in the LV dll or is it a problem wich occurs while passing the string to the LV dll?

 

 

0 Kudos
Message 6 of 13
(5,533 Views)

My understanding is that string passing into LabVIEW dlls should work. A TestStand Application Engineer is currently investigating and will post soon.

 

-Doug

0 Kudos
Message 7 of 13
(5,522 Views)

Hi Doug,

 

you are right, but passing a single string works well. Only passing an ARRAY of strings not. I hope I get an answer from NI.

 

Madottati

0 Kudos
Message 8 of 13
(5,520 Views)

Hey Madottati,

 

It is possible to do this, but a bit of configuration is required. When LabVIEW crreates a DLL with an array as a function parameter, that array is actually represented as a C struct with two members: the array's dimension, and the data itself. Therefore, in TestStand it's necessary to configure the step to pass the array in this format.

 

The basic process is described in a KnowledgeBase article here: http://digital.ni.com/public.nsf/allkb/22BF02003B4588808625717F003ECD67?OpenDocument

 

Essentially, we create a custom data type called LVArray which is an array of strings, and set the properties of that data type so that the strings are passed as a LabVIEW Array when passing into C code. I'm attaching sample code, which includes a TestStand sequence and a LabVIEW-built DLL. This code was created in 2013; if you need it in a previous version just let me know which one you need and I'd be happy to convert it for you.

0 Kudos
Message 9 of 13
(5,505 Views)

Hi Daniel,

 

thanks for your precious reply!

 

I still don't understand the use of the "Array Of Strings" category on the dll's parameter table. Can it only be used on dll's compiled in other languages?

The second thing, I have only LabView 2010 SP1 and TS 2010 SP1, could you please convert your files to these versions.

 

Thanks again

 

ArrayOfStrings.jpg

0 Kudos
Message 10 of 13
(5,490 Views)