09-26-2012 08:55 AM
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!
Solved! Go to Solution.
09-26-2012 12:17 PM
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).