LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

CLFN input recursive STRUCT

I am accessing DLL functions using Call Library Function Nodes, and I have a function that takes a struct (LabVIEW Cluster) to set a trigger. There are a number of unsigned 16-bit words to define the trigger but the final element is a pointer to another (same type) struct so that a series of triggers can be configured. The syntax is:

 

typedef struct MTTRIGGER
{
 U16BIT wCmdWrd1;                               /* CmdWrd1 value */
 U16BIT wCmdMsk1;                                /*CmdWrd1 mask */
 U16BIT wCmdWrd2;                                /* CmdWrd2 value */
 U16BIT wCmdMsk2;                                /* CmdWrd2 mask */

 U16BIT wNextFlags;                                /* Next flags for complex triggering */
 struct MTTRIGGER *pNextTrg;               /* indicates next condition to trigger on*/
} MTTRIGGER;

 

 I have handled a pointer to another function by using a wrapper DLL but not sure that would even work here

(Rolf, are you still out there?)

 

 

Lawrence M. David Jr.
Certified LabVIEW Architect
cell: 516.819.9711
http://www.aleconsultants.com
larry@aleconsultants.com
0 Kudos
Message 1 of 6
(2,799 Views)

Hi Imd2,

maybe this helps.

Mike 

0 Kudos
Message 2 of 6
(2,782 Views)

Hi imd2,

 

Let us know if the former reply was what you were looking for.

 

Otherwise, you'll have to be more specific.  I see no question in your posting.

 

Kevin S.

Applications Engineer

National Instruments

Message 3 of 6
(2,744 Views)

it looks like a good tip generally, but not sure it helps in this situation, he is feeding a LabVIEW cluster into the CIN to generate the c-code

this assumes you are using LV datatypes, but my clients function takes a struct that contains a pointer to another instance of itself. I don't believe that any data type emmulating a pointer to another instance of a cluster (reentrant) exists.

I'm thinking that it may be possible to write a wrapper DLL that will take an array of the cluster without the pointer; and then within the wrapper in a FOR loop assign the *pointer to each successive array element. 

My C is nowhere near the level of my G programming so I need to play with this.

If you know of a cleaner way I would really appreciate it.

thanx

lmd2 

Lawrence M. David Jr.
Certified LabVIEW Architect
cell: 516.819.9711
http://www.aleconsultants.com
larry@aleconsultants.com
0 Kudos
Message 4 of 6
(2,731 Views)
What you are basically referring to is a linked list. As you said, you can simply write a wrapper DLL to create your linked list for your target DLL. For your wrapper DLL you can have an array of clusters with the cluster being what you have above without the "struct MTTRIGGER *pNextTrg;" element, or you can leave it in and simply set it to zero, since a pointer is just an integer value. In your wrapper DLL you can create your linked list based on the individual elements of the array. Your best bet is to Google "linked lists in C" for examples.
Message 5 of 6
(2,723 Views)

thanx, figured I was on the right track,

should be okay now 

Lawrence M. David Jr.
Certified LabVIEW Architect
cell: 516.819.9711
http://www.aleconsultants.com
larry@aleconsultants.com
0 Kudos
Message 6 of 6
(2,713 Views)