LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Programmatically call VI in stand alone application

Hi everybody,

Long time reader, first time writer. I hope I can explain my problem good enough to get help.

 

I am using LabVIEW 2011 and in my current project I have to programmatically call another VI. This works fine in the developer environment but when I build my application this VI is not "bundled" with the EXE and my application still looks for the VI in the path I have defined.

 

I have currently solved this by using a relative path based on the location of the built application and including this VI in the same folder as my built application. It works but it is not an elegant solution.

 

The VI I have to call is indeed included in my project and I have selected it as "always include" in the application builder but it does not seem to help.

 

Thanks,

Jarnebrink

0 Kudos
Message 1 of 3
(2,419 Views)

The issue is probably with where the VI ends up inside the EXE. By default, LV will maintain the hierarchy inside the EXE, so it should be in the same relative position inside the EXE that it was before. Personally, I usually work around all these issues using a very simple trick - drop a static VI reference and drag your VI into it. Then you can use that reference to get the VI Name property for opening a new reference to the VI (or for some things you can use the reference itself directly). This will cause LV to statically link the VI and therefore to correctly include it in the EXE, with all its dependencies. The code for the IDE and the EXE is then exactly the same.


___________________
Try to take over the world!
0 Kudos
Message 2 of 3
(2,410 Views)

What tst said.

 

A while back I made a example of how to use static VI references to get the VI name (or path) so you can do what ever you want.  Here is that post.

 

http://forums.ni.com/t5/LabVIEW/building-an-executable-with-vits-with-Labview-2011/m-p/2384984#M7404...

 

That original post was about how to get the path to a VIT on disk.  But using a static VI reference works better because it doesn't matter where on disk it is, all you need is a reference to it.  LabVIEW realizes it is a dependency and will include it.  Where is it in the EXE when it is built?  It doesn't matter because you have a reference it to.

0 Kudos
Message 3 of 3
(2,383 Views)