From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
07-03-2022 06:09 AM
Hello,
I have a DLL written on c++ that I'm calling from labView, the DLL does a lot of operations that take time, the code is working well, but when I'm running it labview freeze until the DLL operation finish.
i'm using labview : 21.0
Thanks for your helps.
Solved! Go to Solution.
07-03-2022 08:42 AM
Hi Krmbab,
@Krmbab wrote:
I have a DLL written on c++ that I'm calling from labView, the DLL does a lot of operations that take time, the code is working well, but when I'm running it labview freeze until the DLL operation finish.
Yes, LabVIEW will freeze as long as the DLL call doesn't return. What else can it do?
So what is the problem, when your DLL works as expected?
Suggestions:
07-03-2022 08:43 AM
If the functions you try to call do not access global variables or other global resources such as hardware registers or similar, your function should be multithreading safe and you should be able to select in the Call Library Node to execute the function in any thread. Then LabVIEW will call the function in whatever thread it is running in at the time of executing your caller VI diagram, rather than forcing a context switch to the UI thread to safely call your DLL function. The UI thread is the single canonical root thread in LabVIEW that guarantees that nothing that might be multithreading unsafe, including updating the LabVIEW GUI, can run into concurrency trouble. So if your function locks that thread up for intense calculations, LabVIEW can't claim it to keep refreshing its GUI and the application appears to have been locked up until your function returns control to LabVIEW.
If your DLL is multithreading safe is something you as the developer of it should be able to assess. If it is you can safely set the Call Library to execute in any thread. If it isn't and you set it anyhow to execute in any thread you can get weird results and/or crashes.
07-03-2022 11:17 AM
it exactly whate heppen with me, i forget to check run the function in eny thread, thank you very much for your help and your suggestions
07-03-2022 11:21 AM
very nice explanation, it gives me the best practices for my future DLL code, thank you very much for your assistance and your time.