10-27-2023 03:43 AM
I have a very strange behaviour of a particular PPL I'm using. I use a factory pattern to load OOP based plugins. I kept getting errors that the file path was incorrect and the class could not be loaded.
I organize my pluging files (each in its separate project) as
- [plugin name].lvlib
|_ [plugin name].lvclass
The PPL would then be named [plugin name].lvlibp. This way I can get the exported file path using the qualified name
[plugin name].lvlibp:[plugin name].lvclass
One particular PPL wasn't able to correctly load the class. It turned out that the qualified name was the structure as above but instead
[project name].lvlibp:[plugin name].lvclass
Indeed, changing just the project name of this particular PPL changes the qualified name. How is this actually possible, the project name should have nothing to do with the naming of PPLs. Stranger even is that after trying to load this plugin, it appears as [project name].lvlibp in the "Items in memory" dependency folder. As this path does not exist, I get an error at Get LV Class Default Value.vi.
I have tried to replicate the issue by creating a new project and plugin from scratch but I was not able to get the same behaviour.
Here is a test how I load the plugins
With the result here showing the problem. Here the plugin name is 4-Pixel v1, while I changed the project name to 4-Pixel v2.
As said, the wrong, non-existing, file is loaded into memory. The first time loading works well, while loading anytime after gives an error.
What could be the problem? I could circumvent the problem by simply matching the projects name to the plugin name, but this shouldn't happen in the first place and could give bugs in the future.
Solved! Go to Solution.
10-27-2023 07:20 AM - edited 10-27-2023 07:21 AM
Hi Basjong,
I recall having the same issue once while building a packed library, under certain circumstances that I can't reproduce now.
When I made my library name match the project name, the build specification automatically assumed that it must always be the case.
If you open your .lvproj file with a text editor, you can see the xml structure of the project and inspect the build specification. If you go to property "Destination[0].path" of your packed lib specification, you may see that LabVIEW has replaced the actual name of the library by a special tag "NI_AB_PROJECTNAME". Then if your project name changes, so does your built library. If you want to revert it, you must edit your build spec (from the LabVIEW project explorer) and change the name of the library file back to the old value, which will remove the "invisible link" that LabVIEW adds in the name.
In my case I simply ended up renaming my project "[plugin name] Project.lvproj" to avoid this unwanted linking.
This may be a bug or a corner case with specific circumstances that NI did not anticipate.
Regards,
Raphaël.