LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Register a Callback function in LabVIEW

Is there any way to register a callback function in LabVIEW. For example:

I have a DLL on Win2k that run a thread. This thread is doing a certain task (it is not important what it does...) I can't predict when this task will end and I need to know when the task is over. The easy way would be to poll this DLL and ask: "Is it over? Is it over?" over and over again. No! I don't want to poll. Not because it's too easy. I want this DLL to wake me up on time.

Any idea, solutions, function that I'm not aware of, new features...

Thanks

Nitrof
0 Kudos
Message 1 of 6
(3,812 Views)
One possibility would be to create a blocking function in a DLL (maybe in the same DLL) that waits for that event and then create a wrapper VI in LabVIEW to call that function. Then you can use semaphore, rendezvous, notification, or occurrence VIs along with this blocking function to coordinate threads within your LabVIEW code.
0 Kudos
Message 2 of 6
(3,812 Views)
Is it possible to call a dll, block in this dll and being able to do other things in LabVIEW? Dll function were once considered as atomic function in LabVIEW. while calling a dll in LabVIEW. you couldn't do anything else. Did it changed in the latest version7.0?
0 Kudos
Message 3 of 6
(3,812 Views)
I think you're right. Polling may be your best option. You can put your polling function in a different thread, though, and do something else while waiting. Then you can use a rendezvous where appropriate to synchronize the threads. Remember to use a sleep delay between each poll.
0 Kudos
Message 4 of 6
(3,812 Views)

I think I have a much better solution for you. Here is an example program that show how to set a LabVIEW occurence in a dll. Therefore when your dll is done it can set the LabVIEW occurence, meanwhile your VI is just waiting on the occurence.

More infomration on this is in the external code in LabVIEW manual Using External Code in LabVIEW

NOTE:This will ONLY work in LabVIEW 7.

Message 5 of 6
(3,812 Views)
You diserve FIVE star. 4 Wasn't enough. Thanks a lot!

I may have other question, eventualy, some times.

Best regards,

Nitrof
0 Kudos
Message 6 of 6
(3,812 Views)