LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Cannot call NI VIs after build to exe

I'm working on a project about using dynamic load sub vi, its name is Call Block.vi. I use it call all kinds of sub VIs, and it work well as source code.
But after I package Call Block.vi to exe, and use it call other sub VIs, it doesn't work, the error is cannot find some vi that labview its original have, such as Time Delay, Open Config Data, Space constant etc.
I am really confuse about it, does anyone know the reason?

Call Bolck.pngCheck Module PN.pngEXE FAIL.png

0 Kudos
Message 1 of 4
(1,051 Views)

If you call a VI dynamically from an executable, dependencies of that VI will not be searched and loaded just like it would have been called from LabVIEW. You need to make sure that all dependencies are found. Easiest way would be to put them all in the same folder with the VI. You can also create a source distribution of that VI, do not exclude VIs in vilib or instrlib, and call the VI from within that source distribution.

Lucian
CLA
0 Kudos
Message 2 of 4
(1,017 Views)

Thanks LucianM, I have tried to save all those VIs as new copies under the path of my project and disconnected original path, while it still have errors as usual.😭

0 Kudos
Message 3 of 4
(975 Views)

@旺旺~ wrote:

Thanks LucianM, I have tried to save all those VIs as new copies under the path of my project and disconnected original path, while it still have errors as usual.😭


The simple way is to add the VI to the project, so all it's dependencies get included automatically.

 

Either

+ add it to the always include list

+ use a static VI reference directly, or to get the VI's path (or name) to open a new reference to it.

+ put it in some code that doesn't execute, but isn't removed by dead code elimination.


You can also build a source distribution, that should include all dependencies, or, better, a packed library.

 

Keep in mind that the VI and all it's dependencies need to be compiled. So all the VIs need to have separate compiled code option off. The exe won't be able to compile or access the compile cache.  

Message 4 of 4
(959 Views)