Herbert -
Thanks for the feedback. I will look into item (1).
The design of the session manager was to solve the problem of only having to share an instrument within a multithread application. If the session already exists, than you get the same session and thus the same handle, and the instrument is only initialize once and closed after the session no longer exists.
In the case of a C++ based program you would have to add the session as a member variable that has a specific lifetime. When the object is release, so will the session.
In the case of an application like TestStand, you just attach the session to the execution. Once the execution goes away, the session may go away if no other execution is using it.
In the case of L
abVIEW being called from TestStand, you are using VIs as subroutines, so either the application (TestStand) must manage the lifetime of the session, or the VI subroutine must deligate the lifetime control to a "global" VI. The item you attach to the global could be the refnum itself or the SMgr session. One way of doing this would be to create a VI that serves the refnum to you but internally manages the lifetime of the ActiveX references to the Session Manager sessions. This would be a simple vector of names and their sessions. When called the VI would lookup and return a refnum from an existing session or create a new session and return a refnum for it.
Scott Richardson
Scott Richardson
https://testeract.com