LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can pointer be used to read back unknow sized variable

Hi, I am using an in house .dll that acts as a comms wrapper for a communication protocol. When I am reading back data, the .dll passes me a pointer to the payload buffer. In C this makes sence, because i would then go and look at that buffer to get my payload back, but does anyone have any idea how to do this through LabVIEW? The pointer to the payload buffer is a I_32 but the contents of the buffer could be hundreds of bytes long. At current the value returned back to me in the PayloadBufferPointer is always blank, can anyone help me. Cheers, Alec
Message 1 of 2
(2,770 Views)

Hi Alec,

      Configure the Call Library Function to expect a pointer to an array of bytes.  The only caveat is that you must pre-allocate the max "buffer" size in LabVIEW. 

Here, smercurio shows a string-buffer being pre-allocated.

 

If you do this C, then when you go and look at that buffer to get your payload, how will you know where the end of the buffer is?

 

Cheers!

"Inside every large program is a small program struggling to get out." (attributed to Tony Hoare)
0 Kudos
Message 2 of 2
(2,745 Views)