From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Need reference for using C pointers in LV

I'm using code from a dll. One function creates a data structure and returns a pointer to it. (another function loads the data structure). I need to get the data out of the structure. (btw: the structure is **short; short; short; long)
 
How do I use thepointers in LabView?
 
 Thanks
0 Kudos
Message 1 of 3
(2,351 Views)

Hi Rick,

Can't help much but this is what I used. One value from a dll wired to a indicator. The dll uses a pointer for the output data. Works fine.

dll output configuration shown in the picture.

0 Kudos
Message 2 of 3
(2,321 Views)


@Rick N. wrote:
I'm using code from a dll. One function creates a data structure and returns a pointer to it. (another function loads the data structure). I need to get the data out of the structure. (btw: the structure is **short; short; short; long)
 
How do I use thepointers in LabView?
 
 Thanks


If you only need to get the data from the second to fourth parameter you can simply create a cluster containing

int32   pointer
int16   val1
int16   val2
int32   val3

Configure the according DLL function parameter to Adapt to Type and wire this cluster to it. This will allow you to read the val1, val2 and val3. If you need the pointer value too, you really can't aviod having to create a wrapper DLL in C that extracts this information and returns it in a way to LabVIEW that it can deal with.

Also it is very likely that the double referenced pointer will have to be deallocated somehow at some point. This is again something you will have to do in the wrapper DLL. How it is deallocated is completely dependant on your DLL and should be documented in your DLL documentation.

Rolf Kalbermatter
Rolf Kalbermatter
My Blog
0 Kudos
Message 3 of 3
(2,301 Views)