We have an application.exe (Block Diagram attached below) which contains the base class for dynamically dispatching the plugins during runtime.
The application.exe, child class and our dynamic VI uses same API’s of the “NI_AALBase.lvlib and NI_AALPro.lvlib” libraries. When we run using the source code, the child class and dynamic VI launches without any issues.
After building the executable, when the application tries to launch child class we are getting error attached in error1.png file
When the application tries to launch the dynamic VI we are getting the error attached in error2.png file
We tried the following steps to resolve the above mentioned issues:
1. We added the VI search path in the application.ini file for the dependent libraries.
2. We added vi.lib folder and copied the dependent library files inside where the executable is located.
3. We created the source distribution for the dynamic VI.
4. We also unchecked the “separate compiled code from source file” option in the VI Properties for the dependent library API’s
I have attached the source code and exe for the reference.
Can anyone provide some solution to solve this issue? Thanks in advance.
Your plugins really should be built into Packed Project Libraries (PPL). A PPL is a fully compiled library, so it will include all of the vi.lib dependencies, etc. This does go into a rabbit hole since you will also want your base classes also in a PPL. You might want to give this article a good read: Plug-in Architecture using Packed Project Libraries (lvlibp)
Add the Dynamic VI to the executable in "Always Included", In Additional Exclusion Uncheck the "Modify Project Library File.. " option. Refer the attached images for more details.
Uncheck the "Remove Unused members.." in Additional Exclusion and add the child class also in the Always included section.
Anand the idea of the plug in is to modify and extend the software functionality without changing the executable. We cannot add this in always included option.
This issue we facing while we add few specific LabVIEW library vis in the plugin.
I used to do this kind of plugin method in my earlier projects but I'm getting the similar error what you have posted.
I have tried with PPL. I have attached it for your reference. I'm able to dynamically load different child classes which are included in PPL while building executable. However, later when I update the PPL with new child (extension) and use the new PPL in existing EXE, I'm getting Error7 (file not found).
I'm also looking for this solution for one of my application.
Is there any other solution other than using PPL or Source distribution?
I have fixed the issue. Please find the attached modified demo zip. Please refer to LabVIEW Help to understand the root cause of this issue.
LabVIEW Help -> Fundamentals -> Working with Projects -> Concepts -> Using Source Control in LabVIEW -> Facilitating Source Control by Separating Compiled Code from VIs and Other File Types.
Now to fix the issue All did is removed the check box as shown in the image below (and saved the VI) in the VI lib and copied the files next to the exe.
I have another question, If you create a child class for a base class and build the EXE only with the base class then can we expect the child class can be loaded dynamically without any issue? I was under the impression that the child class wouldn't be able to link to a class which is inside EXE, please correct me if I am wrong.
That setting is only/mainly with respect to the SCC context. How does it matter/impact in the current context of dynamically calling any of the non-primitive VIs from vi.lib/err.lib, etc.