LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Call a C function without any interruption

Hello,
 
I have a C function in DLL which manages my serial port and I want to call it using Labview without any interruption.
How can I be sure that Labview will not interrupt this function call ? Do I have to put it in subVI or it's not sufficient ?
 
Sylviane.
 
 
 
0 Kudos
Message 1 of 4
(2,960 Views)
Sylviane,

AFAIK there isn't even the possibility for Labview to interrupt the execution of a DLL (except the DLL needs Synchronisition from Labview).

When you call a DLL the DLL runs in a separate thread and is controled from Windows.

Best regards,

Balze
0 Kudos
Message 2 of 4
(2,951 Views)


@sylviane wrote:

How can I be sure that Labview will not interrupt this function call ?
What do you mean by "interrupt"? The DLL has its own memory space for its internal computations, so LV should not touch that memory.
If you pass a pointer to a buffer into it, you need to be sure not to disturb that buffer.
The CLF node, as far as I remember, executes in the UI thread (unless it is configured as reentrant), so it should block your UI until it finishes.

___________________
Try to take over the world!
0 Kudos
Message 3 of 4
(2,946 Views)


@tst wrote:


@sylviane wrote:

How can I be sure that Labview will not interrupt this function call ?
What do you mean by "interrupt"? The DLL has its own memory space for its internal computations, so LV should not touch that memory.
If you pass a pointer to a buffer into it, you need to be sure not to disturb that buffer.
The CLF node, as far as I remember, executes in the UI thread (unless it is configured as reentrant), so it should block your UI until it finishes.


All the previous answers are right so far. LabVIEW does NOT interrupt DLL calls unless the DLL does do some sort of asynchronous event function or callback into LabVIEW itself.

What the OP probably means is general  suspension of the thread, where the DLL call runs in, through the OS. There is virtually no way from the caller to prevent Windows from taking control from any thread and giving control to other threads to allow Windows preemtive multitasking to work. If you have the source of the DLL itself, there are some WinAPI calls you can add into it, that can temporarily eleviate the priority of the current thread so that Windows is less likely (please note: less likely not completely impossible) to grab execution control and pass it to other threads/tasks in the system.

But if your task in the DLL is so time critical that preemptive multitasking can disturb it, it is really to time critical for a non real-time OS and you should consider a more dedicated solution such as some LabVIEW real-time solution (or Linux realtime or whatever depending how much time and/or money you can invest).

Rolf Kalbermatter 

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 4 of 4
(2,935 Views)