LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Issue in calling a class and VI dynamically from exe

 

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.

0 Kudos
Message 1 of 24
(6,554 Views)

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)


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 2 of 24
(6,532 Views)

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.

 

-----

The best solution is the one you find it by yourself
Download All
0 Kudos
Message 3 of 24
(6,498 Views)

Update:

Uncheck the "Remove Unused members.." in Additional Exclusion and add the child class also in the Always included section.

-----

The best solution is the one you find it by yourself
Download All
0 Kudos
Message 4 of 24
(6,486 Views)

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.

Balaji PK (CLA)
Ever tried. Ever failed. No matter. Try again. Fail again. Fail better

Don't forget Kudos for Good Answers, and Mark a solution if your problem is solved.
Message 5 of 24
(6,478 Views)

Hi Balaji,

 

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.

 

Thanks,

Ajay.

--
Ajay MV


0 Kudos
Message 6 of 24
(6,432 Views)

Is there any other solution other than using PPL or Source distribution?

Balaji PK (CLA)
Ever tried. Ever failed. No matter. Try again. Fail again. Fail better

Don't forget Kudos for Good Answers, and Mark a solution if your problem is solved.
0 Kudos
Message 7 of 24
(6,421 Views)

Hi all,

          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.

Capture.PNG

அன்புடன்
தமிழ் நேரம்
முதல் இந்திய ஆய்வுமெகபொப சிற்பி
சோதனைநிறுத்தம் சிற்பி
மற்ற சான்றிதழ்கள்
யாதும் ஊரே! யாவரும் கேளிர்!!

Message 8 of 24
(6,400 Views)

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.

-----

The best solution is the one you find it by yourself
0 Kudos
Message 9 of 24
(6,377 Views)

Hi Anish,

 

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.

- Partha ( CLD until Oct 2024 🙂 )
0 Kudos
Message 10 of 24
(6,374 Views)