NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Passing an output from a DLL to TestStand

Solved!
Go to solution

I need to convert a VI to a DLL to be used in TestStand. The VI takes a delimited string from TestStand, truncates it to a specified length, and passes it back. The VI works fine in the sequence, but when I built it up as a DLL, it fails to return the output back into TestStand. I'm really not sure if the problem is in the TestStand step settings, or the way I built the DLL. Here are a couple of screen shots. Also, the length of the strings passed in is variable and I'm not sure how big to set the len size.

 

 

Download All
0 Kudos
Message 1 of 6
(4,436 Views)

For your two size parameters, you need to make those the size of the array (100,000 in your case).

0 Kudos
Message 2 of 6
(4,412 Views)

The 100,000 that shows in the char size for my input and outputs was a guess. I set those sizes as they were originally null and erroring.

Somehow the "len" parameter was defaulted to "Step.Result.Error.Code" which obviously was not working. I inserted a fixed value of 100,000, to match the buffer size of the input and output, but I still wasn't getting a return from the DLL. By trial and error (guessing), I had success by lowering the size of "len" to 10,000. I want to better understand how to set these buffer sizes so I can be sure that the DLL will work for all instances.

0 Kudos
Message 3 of 6
(4,374 Views)
Solution
Accepted by topic author drewsali

Hi Drewsali,

 

From what I understand of your question, you have a string input that is passed from Teststand to LabVIEW and back to Teststand. Len determines how much memory of the input string to transfer to and from LabVIEW. One possible suggestion would be to set a local variable that is equal to the size of your input string, then to set the Len buffer equal to that variable so that it passes the size of the string everytime. If you do not want to redefine the len buffer size each time you input a string, just make sure you allocate enough memory for the largest string input you will be inputting. Good luck with your project!

Regards,

Jackie

DAQ Product Marketing Engineer
National Instruments
0 Kudos
Message 4 of 6
(4,364 Views)

Are the units of len and buffer size in characters? If so I can use a simple Len() function in TestStand to get the size of the strings and set len and buffer size programmatically. If not, I'll need to know the conversion to the appropriate units.

0 Kudos
Message 5 of 6
(4,347 Views)

I had some station time today and was able to try the suggestions posted above. Turns out the units of buffer size and len are in characters, so I created variables for the lengths of my input strings, and set the buffer size and len variables equal to the length of the the strings. This almost worked, but I had to add 1 to the string length and set that value to the len variable so it wouldn't cut off the last character in the string.

Thank you AllenP and Jackie_B for your ideas.

0 Kudos
Message 6 of 6
(4,341 Views)