10-16-2013 08:31 AM
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???
Solved! Go to Solution.
10-16-2013 11:50 AM
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
10-17-2013 01:32 AM
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
10-18-2013 03:57 AM
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?
10-18-2013 08:59 AM
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
10-21-2013 03:05 AM
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?
10-21-2013 09:05 AM
My understanding is that string passing into LabVIEW dlls should work. A TestStand Application Engineer is currently investigating and will post soon.
-Doug
10-21-2013 09:08 AM
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
10-21-2013 02:24 PM
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.
10-22-2013 12:11 AM
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