LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamically run VI out of the executable

Solved!
Go to solution

I am trying to run one of the VIs from a source distribution which is located outside the main executable file. When my program is not an executable (just source code), everything works fine. But the VI does not run when called from the executable unless I open the VI's front panel before running the VIs.

 

Is there any way to run the VI without actually opening the front panel? I can probably hide it after opening it but it would be better if it never shows.

0 Kudos
Message 1 of 8
(6,003 Views)

There are several issues in your snippet:

a) You do not care sufficiently about the error cluster. So an error can lead to following errors. This is very bad style.

b) You use a static path for your module. This is highly not recommended. Static paths make distribution nearly impossible!

 

I assume that the exe cannot find the VI in the given location. Does your application find the Vi when executed in LV developement environment with the VI "NonAppVI.vi" notpreloaded by the project or manually (just load the MainVI.vi or whatever its name is)?

 

hope this helps,

Norbert 

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 2 of 8
(6,001 Views)

The above snippet was just a simple Vi I quickly put together to check exactly why a dynamically loaded VI doesn't run from an executable. The real program is more complex than this (and has error handling, proper path input, etc, as you mentioned).

 

The VI runs from the source code even if NonAppVI.vi is not in the memory at the time the caller starts running. The EXE seems to find the VI because it gives me all the properties associated with and I don't get any errors. So far what I see is the front panel just being loaded into the memory is not enough to make the VI run. The front panel needs to be opened. Not sure why.

0 Kudos
Message 3 of 8
(5,995 Views)

I have attached the whole code. You can select the dynamically loaded vi's path using the file dialog box.

 

0 Kudos
Message 4 of 8
(5,990 Views)

As far as i understand the code and the behavior of the exe, everything works as expected.  Therefore, i am wondering what you expected the code to do. How do you "check" that it does not work the way you like it?

 

Norbert 

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 5 of 8
(5,960 Views)
-Run the executable Dynamic Caller.exe

-Make sure "open front panel is false". You will see the counter increasing.

-Now manually open up Dynamic Vi.vi. You'll see that it is not running. I was expecting it to run and show an increasing counter. When you press stop on the caller vi, it should also stop Dynamic vi.

 

0 Kudos
Message 6 of 8
(5,946 Views)
Solution
Accepted by topic author abdel2

@abdel2 wrote:
[...]-Now manually open up Dynamic Vi.vi. You'll see that it is not running. [...]

And this is expected behavior. The reason is simple: You are opening a new vi, not the one called by the executable.

LV is using "Application Instances" in order to distinguish between different execution contexts.

The executable runs in another application instance then the VI in the developement environment.

 

If you want to transfer data between exe and developement environment, you have to follow the instructions of this KB.

 

hope this helps,

Norbert 

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 7 of 8
(5,944 Views)

Thank you! That clears things up.

 

Since you said Labview opens up another instance of the vi, I put in a second notifier that sends continuous data from the dynamic vi to the caller vi and I can see that the data is being transmitted. Now that this is solved. I'll move on with testing the real dynamic vi I'm trying to call and see why it doesn't run properly.

 

Thanks again!

0 Kudos
Message 8 of 8
(5,931 Views)