NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Questions on CVI communications with Teststand

I know,when building a DLL in CVI, in order to get Teststand Station globals variables, I can use the forms like below, and then insert that DLL adapter step in Teststand.
int DLLEXPORT Example(CAObjHandle seqContextCVI)
{
}
However, If I'm developing an EXE application in CVI, how can I get the similar "CAObjHandle"? I preper to see: insert a "call executables" step in Teststand and then everytime when I run this step, This exe application can get the Teststand station globals variables.
 
Thanks!
Jacky
 
0 Kudos
Message 1 of 3
(3,158 Views)
Hi Jacky,

Aside from command line arguments, which are static, there is no simple way to pass information into an executable being called by the "Call Executable" step type. It may be possible to pass the sequence context using more advanced mutl-threading techniques.

Another thing to mention is that if you are looking for information that is contained within the Station Globals - any instantiation of the engine would be able to reference them. Since you can create an instance of the TestStand Engine in any code module, it is feasible to create an instance in your executable, which could then reference the Station Globals without ever needing to pass the sequence context into your exe.

Generally speaking however, the preferred method for getting the sequence context into your code is by using DLLs. It is straight forward and quicker to implement.

Hope this helps Jacky, have a good one!

Dan Weiland
0 Kudos
Message 2 of 3
(3,141 Views)

I wouldn't create another instance of the engine in a separate process to share station globals because any changes to globals in the first process that have not been persisted will not be seen by the second process and vice versa.

You could register TestStand objects such as the engine (or even a sequenceContext if you made sure you only used it while it is active) with a third ActiveX executable process that would provide an interface for other processes such as your executable to retrieve the registered object.

The NI Session manager is capable of doing this, but I don't know if there are any examples for this. The trick would be to register the objects you want to share with a custom session whose name begins with an asterisk. The asterisk tells the session manager to hold on to the object in an external singleton process so that any process that requests the same session name gets the same object instance.

Of course, if you are using ActiveX in your exe, it would be simpler to make your exe a server and just pass data via method parameters using the ActiveX adapter. Of course, then you should consider that if your server was a dll instead on an exe, you could instantiate it in the same process and your performance would be much better.

 

0 Kudos
Message 3 of 3
(3,126 Views)