02-24-2011 11:16 AM
Can you post your code? It's unclear how you have it set up. You can set an array type in Call Library Function by choosing "Array" as the parameter type. When you do this you're just passing a pointer to a memory location; it's up to you and the DLL to agree on the size and format of the data at that location in memory. As long as you're allocating the right amount of space, the format in LabVIEW does not need to match the format in the DLL (there's no difference between an array of U8 and array half that length of U16). Allocating the memory using Initialize Array is the right way to do it. Typecasting an input is going to cause you problems - it sounds like you're taking an actual U8 value and passing that as a pointer, although again without seeing your code it's hard to know.
02-24-2011 12:08 PM
Ok. I feel dumb now. I didn't even notice there was an "Array" type that I could use for my DLL in LabView. I changed that to Array and all is well. You were right. I made it a lot more complicated than it needed to be.
02-24-2011 12:12 PM
Now I feel evern more dumb. I didn't notice the "Page 2" at the bottom of this website, so I came to your solution independent of your post. Everything works now. I love LabView. I just need to find those dormant brain cells that contain my LabView knowledge.
03-21-2011 03:14 PM
Hi all!,
I have a problem with a C++ code that I call from Labview.
First, I wrote a C++ code for a readilng from a serial communication that I run without problems on Win32 with debug. Also, I can see my buffer on the console without problems.
My C++ code for the visualization on the console looks like that:
cout << (int)MiBuffer[0]<< endl;
cout << (int)MiBuffer[1]<< endl;
cout << (int)MiBuffer[2]<< endl;
cout << (int)MiBuffer[3]<< endl;
cout << (int)MiBuffer[4]<< endl;
For the calling of each byte of my buffer from Labview I wrote pointers variables in the function that will be called from Labview (in my DLL).
int call (int *RBuff00, int *RBuff01, int *RBuff02, int *RBuff03, int *RBuff04)
*RBuff00 = (int)MiBuffer[0];
*RBuff01 = (int)MiBuffer[1];
*RBuff02 = (int)MiBuffer[2];
*RBuff03 = (int)MiBuffer[3];
*RBuff04 = (int)MiBuffer[4];
But now, when I link my DLL on Labview and I run the program, I receive all my data on the variable "*RBuff00", while the others variables show nothing....also, my "*RBuff00" variable changes its values while the others are still in nothing...
Can you help me pleace?
I don't know where is thye problem if my normal C++ code run good on the console...
Thanks
03-21-2011 03:18 PM
Please post your LabVIEW code and a C++ header file showing the function prototype, or at the very least, a screenshot showing how you have configured the Call Library Function node.
03-21-2011 03:30 PM
here there is a screenshot of my header...
03-21-2011 03:31 PM
here there is a screenshot of my header...
03-21-2011 03:34 PM
And I receive only data on my frist variable...here a screenshot
03-21-2011 03:35 PM
How is your Call Library Function Node configured?
Have you considered returning an array instead of a bunch of individual parameters?
03-21-2011 03:37 PM
Yes, I already did what you say. I did an Array in my c++ code and I receive only data on the fist line of my array...also, the same problem