LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Labview, ActiveX, and VarPtr

I currently have a 3rd party ActiveX product that I am using with Labview 11.0.  One of the Methods requires me to pass the VARPTR of a TYPE (Labview Cluster) and the LEN of the TYPE.  In Visual Basic, VARPTR and LEN produces a 32bit signed long integer word.  How do I get the Labview-equivalent of VARPTR and LEN values of a Labview Cluster to pass to the routine.

0 Kudos
Message 1 of 4
(2,225 Views)

This thread may contain your answer.

 

http://forums.ni.com/t5/LabVIEW/Pass-Type-to-ActiveX-Dll/td-p/579815

CTA, CLA, MTFBWY
0 Kudos
Message 2 of 4
(2,205 Views)

That link did not really help.  In VB6, VarPtr gets the memory location of the variable as a 32bit integer.  Len gets the memory size of a variable as a 32bit integer.  In C, a pointer (*) and len() function would get me that information.  There does not seem to be an equivalent function in Labview to do this (or at least what I can find).  Any thoughts?

0 Kudos
Message 3 of 4
(2,183 Views)

You can get a pointer to a memory address in LabVIEW.  The functions you'll need are DSNewPtr, MoveBlock, and DSDisposePtr.  These functions are built into LabVIEW and you can call them using a call library function node configured with the library name set to "LabVIEW."  They are documented in the LabVIEW help, and there are examples for how to use them on this forum.  You can get the size of a cluster by flattening it to a string, then getting the string length.  If your ActiveX component expects to do something useful with that cluster, you may need to reorganize the cluster or add extra padding elements because LabVIEW does not necessarily pack structure elements the same way other software does.  Also be aware that LabVIEW data has the opposite endianness of most Windows software so you may need to do some byte-swapping.

0 Kudos
Message 4 of 4
(2,175 Views)