LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to pass a struct to LabView

I have a LabVIEW application that reads data from SCRAMNet card and process/display data to front panels. 

 

NI provides SCRAMNET.llb (a set of VIs using Call Library Function Node) to call read/write functions in a vendor provided DLL that supports SCRAMNET card.  But the problem is that every time to get the data from the card in LabVIEW, you have to provide specific memory offset to call the read/write VIs in SCRAMNET.llb.  Dealing with offset values to get data seems cumbersome.  

 

We have struct data type defined in a header file for the program that writes data to the SCRAMNET card.  I am just wondering if there is something I can do in LabView that the DLL returns the struct as a pointer and load it to a cluster so that I can access the SCRAMNET struct data via accessing each element of the cluster.  If it is possible, is it an easy thing to do or not. 

 

Thanks for your advice in advance!

0 Kudos
Message 1 of 4
(2,900 Views)
If you cast your Struct to a byte array, so you can unflatten this array to a (similar) cluster in LabVIEW and ariive each element of your DLL-Struct.
0 Kudos
Message 2 of 4
(2,894 Views)

Do you have a specific topic or example in the website LabVIEW Tutorial  you referred to?  Thanks!

0 Kudos
Message 3 of 4
(2,877 Views)
Sorry, that's my signature and no reffering for this topic. But I think there is no problem to pass a structure from DLL to LV and back. I did it more than once.
 
And how I sad, you can unflatten your structure in LabVIEW to a cluster. There may be some problems in unflattening if you have arrays in your structure. So you have to unflatten the peace of structure before array, than unflatten the array and then the rest of the structure.
0 Kudos
Message 4 of 4
(2,860 Views)