LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Passing an array of structures to a dll

Hi,

 

I am trying to get a dll in labview to work with my project and am having trouble getting the library node to accept one of my parameters. The function I am using is defined below with an example from the documentation. MaxDeviceLen is defined as 512. I have tried creating an array of unsigned bytes with length 512, building it to a cluster for the struct, and then building it into an array to be input into the call library node but that did not work. I have also tried converting it into an array of clusters of strings to no avail, as well as a couple of other similar approaches. Any help on this would be greatly appreciated.

 

Dllfunction.PNGdllheader.PNGdllexample.PNG

 

 

0 Kudos
Message 1 of 3
(2,214 Views)

Basically that string is inlined. So you need to allocate an array of U8 bytes with n * MaxDeviceLen elements (with n being the number of array elements you want to have and which better matches the third parameter passed to DelcomScanDevices() ) and pass that as Array Data Pointer to the DLL. Then to index the i-th element to pass to the DelcomOpenDevice() function you simply use ArraySubset with the offset set to i * MaxDeviceLen and the length as MaxDeviceLen and pass this array as Array Data Pointer to the DelcomOpenDevice() function.

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 2 of 3
(2,127 Views)

Rolf,

 

Thank you for your reply. I have decided to go with another function that essentially does what I want instead and is a little easier to work with.

 

Thanks,

 

-Martin

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