LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Help me:Calling C dll to get cluster data

 

I have read the .d7d data files with the DWDataReaderLib.dll in labview,i can get the data and time_stamp through allocate memory (data and time_stamp)  then call DWGetScaledSamples ,but when i want to allocate the DWChannel structures then call DWGetChannelList to get channel list properties,it will fail .In fact,now i don't konw how to get channel list .In my program,i have allocate the DWChannel structures ,but it doesn't export the data ,and when i wire the array of channel list,the labview will destroy.thanks

 

0 Kudos
Message 1 of 2
(2,142 Views)

You can't do this in the way as in your example. Your DWEvent and DWChannel structures both contain fixed sized string elements. This means they are inlined in the structure. The only way in LabVIEW to create a compatible structure is to create an embedded cluster with the according number of byte elements. So your DWEvent cluster should be really a LabVIEW cluster which contains  an int32 event_type, a 64bit float, and then another cluster containing 200 unsigned 8bit integers. The same rule will accordingly apply to DWChannels.

 

On return you can then use ClusterToArray and then ByteArrayToString to convert these bytes into a string. You should clip the array to the first 0 byte before converting to a string, otherwise you will always get strings that contain 200 characters, with random characters after the first 0 byte character in the returned data.

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