TestStand supports passing an instance of a LabVIEW Class data type, also called a LabVIEW class object, wired to and from the connector pane of a member VI. You can store LabVIEW class objects in TestStand object reference variables.

When TestStand passes an object reference variable that contains a LabVIEW class object to a code module, the class object is always passed by value. To ensure that changes made to a LabVIEW class object persist in a code module, you must pass the class object as an output from the code module and store the output in the TestStand object reference variable. The object reference variable will contain a new instance of the class object with the updated data.

Class Object Lifetime

The lifetime of the LabVIEW class object is the lifetime of the TestStand object reference variable that holds the LabVIEW class object. If the VI that creates the LabVIEW class object is running in the context of a LabVIEW project, the lifetime of the LabVIEW class object is the lifetime of the LabVIEW project. When the object reference is released either by going out-of-scope or by obtaining a new value, the LabVIEW class object is also released. This behavior is different than other LabVIEW reference data types, such as an I/O reference.

The VI that creates the reference determines the lifetime of LabVIEW reference data types stored in TestStand. As long as the VI that created the LabVIEW reference is reserved, the LabVIEW reference is valid. This is not the case for LabVIEW class objects. A LabVIEW class object remains valid even after the VI that originally created it is unreserved or closed. If LabVIEW is restarted, trying to use a LabVIEW class object a previous LabVIEW instance obtained results in an error because the LabVIEW class object is not valid in the new instance of LabVIEW. In addition, if you try to use the LabVIEW class object after you close the LabVIEW project context in which the LabVIEW class object exists, an error occurs because closing a LabVIEW project context releases all LabVIEW class objects created in the project context.

Calling a Compatible Class Member VI

When you select the VI Call option from the Call Type ring control on the LabVIEW Module tab in the TestStand Sequence Editor or on the Module tab of the Edit LabVIEW VI Call dialog box in a TestStand User Interface, you are responsible for calling the appropriate member VI for the LabVIEW class object stored in TestStand.

Because you can pass any instance of a LabVIEW class object to any member VI from TestStand, no guarantee exists that the LabVIEW class object you passed to the member VI is compatible with the class object the member VI expects. To help LabVIEW check that the class object you passed from TestStand to the member VI is compatible with the class object the member VI expects, add the Preserve Run-Time Class function to the member VI. The Preserve Run-Time Class function returns an error if two class objects are incompatible. You can work around this limitation by creating top-level wrapper VIs that call dynamic dispatch member VIs of LabVIEW class objects when you select the VI Call option from the Call Type ring control to configure LabVIEW steps.

Note
  • LabVIEW 2012 or later returns an error if you call a dynamically dispatched member VI that passes a derived class on the dynamic dispatch input terminals. For the dynamic dispatch to work properly, you must select the Class Member Call option from the Call Type ring control when you configure the step.
  • TestStand supports executing a VI with a LabVIEW Class Reference parameter only when you execute the VI as part of a running sequence. Edit substeps and OnNewStep Custom substeps do not execute as part of sequence execution and cannot contain direct LabVIEW Class Reference parameters. If you need to pass a LabVIEW Class Reference, serialize the reference to a string parameter.