LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

External dll with array of struct

Solved!
Go to solution

I am trying (new at this) to call an external dll.  The function prototype looks like this:

 

int FUNCTION( int *Count, struct List_t *List );

 

Count is a Long

List_t is a struct that looks like:

 

typedef struct List_t
 {
 char  Name[MAXCHARS];
 char  File[MAXCHARS];
 double Length;
 bool  wired;
 bool  DDD;
 };

 

and List is an array of length (MAX-1), where MAX is defined as 10 and MAXCHARS is defined as 48.

 

This is my latest try:

block diag.GIF

 

and I have the List parameter as "adapt to type", and "array data pointer".

 

I get some correct data back, but not all.

 

Thanks

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

In your Array to Cluster function, what size are you setting the cluster to?  It should be the same number as MAXCHARS.  Right click on the function to set its size.

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 2 of 4
(2,475 Views)
Solution
Accepted by topic author AZTD

And in addition to what tbob said, you better make sure that the count input never is higher than 1 as the function might otherwise try to fill in beyond the end of the single element array you pass in and that can AND WILL corrupt your memory eventually causing some crashes, though that doesn't need to crash immediately.

 

What you probably should do is replacing the Build Array Node by a Initialize Array Node and wire the count control also to the size input of it. Set the count to 10 and on return use the count output to resize the array using Reshape Array to the size that was filled in.

Rolf Kalbermatter
My Blog
0 Kudos
Message 3 of 4
(2,452 Views)

Guys, thanks for the help.  It was the initilize array problem that was driving me crazy.  I could change the cluster size and see all (most) of the text in my first string, but I could never get the array portion working properly.

 

Thanks for the additional eyes on my problem!

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