LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

creating an interface with wrapper dll including a callback function

The follow KB should help you in importing a custom data type in the Call Library Function Node.

 

How Do I Use Adapt To Type For Call Library Function Nodes?

0 Kudos
Message 11 of 15
(1,879 Views)

Thanks for the tip.  Part of my problem was that I was using the LabVIEW "import dll" utility which I can see now isn't all that usefull except maybe for dll functions with parameters that are simple data types.  Otherwise it's more trouble than it's worth.  I used the "Call Library Function" which works much better.  I could not get the cluster stuff to work on my first try so I just passed the 6 separate arguments that consisted of 4 pointers to uint32_t parameters and 2 string handles.  That worked fine.  I might try the cluster stuff again using the "Adapt to Type" feature, but since I'm writing this for others to create their own VIs, it might be better to keep it simple and just pass the 6 separate parameters.  

 

Now, on to callback functions and user events ...

 

0 Kudos
Message 12 of 15
(1,868 Views)
OK, so I've added "Create User Event", "Register For Events", and an "Event Structure".  I've wired these up. I added a time out so I could test that and it works.  I use PostLVUserEvent in my wrapper DLL to post the event with some event data.   I've added a case to the Event Structure for the event.  How/where do I get the event data so I can connect it to my Event Structure case?
0 Kudos
Message 13 of 15
(1,839 Views)

Take a look at this example, they use the ItemTag and code associated with each user event to pass data into the event structure.

 

Custom User Events in LabVIEW - Advanced event driven programming 

 

-Hunter 

 

 

Message 14 of 15
(1,815 Views)
Ya that helps,  I figured out how to get the data posted in the DLL (using PostLVUserEvent) into the event structure, but I haven't tested that yet.  Though we will normally be triggering the event from within the DLL, I thibk this example shows me how I can force the event from a VI which should be a useful way to test my event cases.
0 Kudos
Message 15 of 15
(1,805 Views)