05-29-2019 11:09 AM
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;
05-29-2019 11:34 AM - edited 05-29-2019 11:35 AM
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.
05-30-2019 04:14 AM
Thanks a lot..I am gonna try the second option.I don't really understand the first option
05-30-2019 06:08 AM
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.