Using LabVIEW Classes in an Application

LabVIEW 2018 Help

Edition Date: March 2018
Part Number: 371361R-01
View Product Info

DOWNLOAD (Windows Only)

LabVIEW 2016 Help
LabVIEW 2017 Help
LabVIEW 2018 Help
LabVIEW 2019 Help
LabVIEW 2020 Help

LabVIEW classes are user-defined data types. LabVIEW class developers create and distribute these data types. The LabVIEW class user does not need to know how to create a LabVIEW class, but rather how to use the data type a class defines in an application, what information is available to them in debugging code that uses LabVIEW classes, and how a new version of the LabVIEW class might affect the application the programmer has built.

Creating an Instance of a Class

The LabVIEW class does not need to be in the project. You can add the LabVIEW class to the palette so you can easily find and drag the class to the block diagram or front panel window. To create an instance of the LabVIEW class you receive or create, place the class library file (.lvclass) as a control or constant on the front panel or block diagram on which you want to use it. You can use a LabVIEW user-defined data type similarly to other LabVIEW data types.

Using the Class Browser window, you can place member VIs of the LabVIEW class on the block diagram.

Using Context Help and Probes with Locked LabVIEW Classes

The LabVIEW class developer may lock the LabVIEW class when he or she distributes the class. If the LabVIEW class developer locks the LabVIEW class, the Context Help window only displays the data type of the class and the description of the class if the developer provides one. LabVIEW also only displays the data type of the class in the generic probe on a locked class. You can create a non-member custom probe for a LabVIEW class, however the non-member custom probe only can display the public interface of the class. The LabVIEW class developer also can set a custom default probe for the class to provide specialized class information for debugging. Work with the LabVIEW class developer to provide the appropriate amount of documentation or probe information necessary for working with the LabVIEW class.

Dynamic Dispatch VIs

Some member VIs of a LabVIEW class can be dynamic dispatching. Dynamic dispatch methods are similar to polymorphic VIs. Where polymorphic VIs decide which VI to call depending upon the data type you wire to it, dynamic dispatch methods wait until run time to decide which member VI in the class hierarchy to call depending on the data that arrives at the input. Because a LabVIEW class wire can carry data of its own type or data of any child type, LabVIEW determines which member VI in the class hierarchy to execute at run time. You can double-click dynamic dispatch member VI on the block diagram to view the particular VI that is on the block diagram. To view the other dynamic dispatch member VIs in the class hierarchy, you must view each individual VI in the class hierarchy.

Mutating Data

Tracking the version number of the LabVIEW class is beneficial to LabVIEW class users who develop applications using LabVIEW classes. For example, you have a LabVIEW class in an application that uses an unsigned 32-bit integer in the private data control of the class. A LabVIEW class developer can send you a version of the LabVIEW class that changes the numeric control in the private data control to a double-precision floating-point number. Because LabVIEW tracks version changes and knows how to flatten and unflatten data on all LabVIEW classes, you can replace the old version of the LabVIEW class with the new version and run the program without making changes to it.

Note  If you try to unflatten data from a future version of a LabVIEW class, LabVIEW returns an error. For example, this error might occur if you have data with a version number of but the LabVIEW class in memory is version


Not Helpful