My info is marked with ***s.
> Assuming I specify all dll calls as re-entrant, the number of
> simultaneous dll calls that can be made from within labVIEW is limited
> to the number of threads. Specifically, once the dll has control of
> the thread, nothing else in labVIEW can execute in that thread until
> the dll call completes. Yes?
>
A DLL doesn't normally multitask with other code, but there are
situations where it does, such as when the DLL decides to process or
pump messages. The above assumption is pretty accurate, but there are
things a DLL could do that would void them.
> If a thread ID were attached to information passed to a labVIEW
> library function, and that function retained the information for
> labVIEW, then labVIEW in theory could request the information from the
> function when the dll call completed. The thread Id would uniguely
> identify the data because only one dll call can be made with that
> thread from within labVIEW and of course labVIEW knows which thread is
> making the call. Yes?
>
I'm not sure I understand where this is going. Any DLL is free to pay
attention to the thread ID, but there is no guarantee that the same
thread will be used for the VI's next execution, or for the DLL's next
execution. Information can be stored by the DLL using the threadID, but
LV doesn't know anything about the information or even which thread
executed the DLL once it returns.
Perhaps this info will help out. LV has two ways of executing a DLL
call. If the DLL call is marked as reentrant, then it will be called in
the current thread. It is then the DLL's responsibility to protect any
data or code section that cannot have multiple threads in it simultaneously.
For compatibility, and to make it easy to protect a DLL call, you can
mark it as non-reentrant. This will cause the DLL to be swapped over to
the UI thread so that any other thread trying to call the code at the
same time will be blocked, and the DLL call will be protected.
If you have other questions, ask them.
Greg McKaskle