LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Copy untyped void * buffer over LabView struct equivalent

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.

0 Kudos
Message 11 of 39
(1,502 Views)

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.

0 Kudos
Message 12 of 39
(1,498 Views)

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. 

0 Kudos
Message 13 of 39
(1,497 Views)

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

 

0 Kudos
Message 14 of 39
(1,474 Views)

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.

0 Kudos
Message 15 of 39
(1,472 Views)

here there is a screenshot of my header...

0 Kudos
Message 16 of 39
(1,470 Views)

here there is a screenshot of my header...

0 Kudos
Message 17 of 39
(1,467 Views)

And I receive only data on my frist variable...here a screenshot

0 Kudos
Message 18 of 39
(1,461 Views)

How is your Call Library Function Node configured?

 

Have you considered returning an array instead of a bunch of individual parameters?

0 Kudos
Message 19 of 39
(1,457 Views)

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

0 Kudos
Message 20 of 39
(1,454 Views)