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,722 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,692 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
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 3 of 3
(2,672 Views)