From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Configure string parameter for LabView dll

Solved!
Go to solution

Hi,

 

I have created a simple LV 2010 vi (Starting vi) that reads the identification of an oscilloscope. I then take this vi and build it to a LabView dll. I test the dll by calling it from LabView (RunFrom dll). It essentially seems to work but len and ReadBuffer come back blank. It has to be in the way I am configuring the parameter setup for Readbuffer (Parameter Setup) in the dll configuration. I have tried several different configurations but nothing seems to work. Any help is appreciated!

Jim Haas
Download All
0 Kudos
Message 1 of 2
(2,469 Views)
Solution
Accepted by topic author JHaas

What's the len parameter for?  Normally you would set that as the length of the string, but it appears you haven't done that.  Also, you're passing len by value, not by reference, so the function expects it to be an input and you'll never get back a value other than whatever value you provide.

 

Don't use a local variable of ReadBuffer for the "readbuffer" input.  You need to pass an initialized string long enough to hold the expected amount of data.  The easiest way to do this is to use Initialize Array to create an array of U8, then use byte array to string.  Set the "minimum size" parameter to "len" and pass in the length of the initialized string (this isn't required but is good practice).  If you need the resulting length output, add another indicator and parameter for that value.  There might be a way to do it with a single parameter by passing len by reference, you'd have to experiment (it's definitely doable in C but I don't know if LabVIEW allows it).

Message 2 of 2
(2,417 Views)