LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

pass struct with linked list to call library function

Do you know how to pass a double pointer to the call library function? In otherwords, do you know how I can pass the struct below to a call library function. Thank you.

typedef struct CSI_Tree

{

 struct CSI_Tree *sibling;

 struct CSI_Tree *child;

   int childrenProbed;

} CSI_Tree;

0 Kudos
Message 1 of 4
(1,871 Views)

If you can change your dll, split the structure into 3 parameters.

If you can not change the dll, create a wrapper dll to call the dll.

 

 

George Zou
0 Kudos
Message 2 of 4
(1,859 Views)

Thanks a lot..I am gonna try the second option.I don't really understand the first option

0 Kudos
Message 3 of 4
(1,829 Views)

Basically LabVIEW doesn't really have pointers so you can't directly implement linked lists. What you can do is however a different approach where you implement the list as a (optionally sorted) array with a prev and next index instead of a pointer. This index is simply the index into the array.

This approach has certain advantages and disadvantages in comparison to truely linked lists. The advantage is that a single array of elements is a lot easier on the memory manager than many thousends of small records shattered throughout the memory. The disadvantage is that inserting and deleting elements can be more involved depending if you want to maintain a certain order in the array too. If the order in the array is not important it is pretty much the same as with pointers except that you modify the indices in the relevant records instead of the pointer.

 

The alternative is to write a wrapper (or modify the DLL itself to add this functionality if you can as that saves you an extra DLL that you have to distribute) that provides accessor functions to retrieve the next and prev element given a specific element.

Rolf Kalbermatter
My Blog
0 Kudos
Message 4 of 4
(1,823 Views)