05-25-2008 07:30 AM
05-25-2008 09:20 AM
05-25-2008 10:12 PM
05-26-2008 01:42 AM
The problem is actually here but not as you describe it. The DLL node seems to be configured right since you wire an array of doubles to these three parameters. The problme is about memory allocation.
I made a vi which performs FRA. I built its DLL.
I have around 10 inputs. I output 3 one-dimensional arrays, and a string from the DLL.
When i build the DLL, the builder defines the outputs 'gain', 'phase' and 'frequency' as arrays of 8-byte double.
When i call this DLL in my vi, the configuration window sets them as 'numeric' outputs.
05-26-2008 01:55 AM
05-26-2008 02:02 AM
05-26-2008 02:07 AM - edited 05-26-2008 02:11 AM
You do need to make sure to initialize the arrays to the length indicated by your len1, len2, len3 parameters that you also pass to the DLL. An array constant contains only as much elements as you explicitedly enter into it (usually 0, which means it points to a memory area of 0 bytes length). Initialize Array will create a memory block that is large enough to contain the number of elements you specify as length parameter.
@MScap wrote:
Sir,
I tried using a initialize array function in place of array constant, but in vain.
LV is still crashing.
Also, what is the difference in using an 'initailize' function and an 'array constant'? I am finally getting a 1-D array.
The other doubt i had was : why does the 'call library function node' configuration window detect the outputs 'gain','phase' and 'frequency' as numerics and not arrays?
05-26-2008 02:15 AM
05-26-2008 02:51 AM
Same issue probably. When you pass a C data pointer (string or array) you need to make sure to allocate the necessary memory for that parameter in the caller (here your LabVIEW diagram). The DLL has no way of allocating that memory and returning it to the caller.
@MScap wrote:
Thank you sir!
I got the point.
I made sure that the no.of elements is same as that of len1,len2 and len3. All these three values are same as the input 'no.of steps'. So, I connected them all together.
Now, it runs fine when i pass all the inputs.
I have a validation process in my code, which gives an 'error message'(as a string) when any input is not valid ( usually out of data range).
LV is crashing, now, only if there are any empty inputs passed to it.
When i run the vi without passing any values to the controls, its crashing.
Also, its crashing when i enter few inputs and leave others empty.
Actually, when no data is passed to the vi, the vi must return a string (of max 412 characters) that the values are not valid.
I am gettign this string as the output and then LV is crashing. I am not able to find out the reason.
Kindly look into this!
05-26-2008 03:21 AM