11-07-2019 05:51 PM
LVOOP noobie here.
I have created a HAL class to use in a LabVIEW project (e.g. DUT.lvclass being a parent class with other child classes inherited from it).
When I tried to instantiate a class in a Main.vi (screenshot below, development mode) it works.
But when I build that *.vi into EXE, the program is unable to instantiate the class.
It seems that in EXE mode, the program is unable to locate the constant DUT.lvclass object.
Did I do anything wrong here?
11-07-2019 09:36 PM
I see two possibilities.
One, you are using current VI's path constant, but in an EXE the path of a VI is different than it is in the development environment. The name of the executable file becomes a layer in the path. You may need to do a strip path when this VI is within an EXE.
Two, perhaps the file you are trying to open wasn't included in the EXE, or installed into the directory where you think it should be. Perhaps you should be using Application Directory constant.
11-08-2019 02:58 AM
IIRC, if the class is included in the executable, the path doesn't matter. LV looks for the name, and if it's in memory it will ignore the path.
If this class is always included, simply add a class constant anywhere on a included diagram. If not, expect high maintenance. You can include an empty VI (by putting it somewhere that is included) and use a pre-build script to set (with scripting) all used class constants in it's diagram... This way, you can't forget to include a new one.
Note that adding a parent to the build (any which way) won't automatically include it's children. A child requires the parent, so when a child is added, it's parent (recursively) is added.