Peter wrote:
> I have looked at the ni.com site and several other labview support
> forums on the web and have seen references to a similar approach but
> have not been able to find any examples. When I have called the DLL
> from Labview execution of the VI that calls the DLL is suspended until
> the DLL returns.
>
> Does anyone have examples of code that would do this or suggestions on
> how to accomplish this
I really depends on your DLL. If you know that the DLL is basically
thread safe you can set the Call Library Node to use reentrant (the
CLN color will then change from orange to light yellow)
LabVIEW itself is inherently multithreading so you can at a different
position in your program call another DLL function which sets a global
value in the DL
L to tell it to terminate whatever it is doing at that
moment.
If your CLN is set to be non-reentrant it will be executed in the UI
thread and LabVIEW will never execute anything else in the UI thread as
long as the DLL function hasn't returned.
In LabVIEW 7.0 you won't even have to take special precautions once you
have made the DLL calls reentrant as LabVIEW acquires by default several
threads per execution system.
In LabVIEW before version 7.0 it only acquired one thread per execution
system which means that the execution system calling a DLL function will
be suspended anyhow, but you can assign the VI which is supposed to
abort the DLL by calling another DLL function call from another place in
your application which is set to execute in a different execution system
than your main (number crunching) DLL call.
You assign executions systems to VIs in the VI Properties under the
Execution settings.
Rolf K