LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Can't find my dynamically loaded VI path

Hi Folks,

 

I wrote a small VI to aid with file paths used for dynamically loaded VIs. It has worked well up until this point, when I tried to use it in a larger project. I can't seem to figure out what's wrong here - I was under the impression that as long as the (called) VI was included in the build, that it should be available from \built.exe\...

 

In terms of directory structure, the caller VI is at:

C:\Projects\LabVIEW\ABES v6.0.1\toplevel_602.vi

 

The called VI is in:

C:\Projects\LabVIEW\ABES v6.0.1\subvis\GUI\preferences\GUI_preferences.vi

 

Caller:

evt_handler.PNG

 

 

 

The 'AutoPath' VI:

autopath.PNG

 

Info received when trying to call subvi from BUILT exe:

built_toplevel.PNG

 

Finally, project structure (auto-populating directories) and build spec's:

 

proj_hierarchy.PNG

build_specs.PNG

build_specs2.PNG

 

What is it that I'm not getting here?

 

Thanks for reading,

Jamie

v2009 devel. w/RT
0 Kudos
Message 1 of 11
(5,299 Views)

In LV 2009, files are saved inside the executable using the same hierarchy they had before the build (as you can see from your middle image which clearly shows folders inside the EXE).

 

The easiest solution for both the IDE and the EXE is simply to have a VI which will return the path of the plugin folder (easily done if you save it there), which you can then use to build the full path. See the top half of this image for a simplistic example:

 

References.png

 

 

The bottom half shows an even easier way - if you use a static reference, you don't need to use any paths and the VI is automatically included in the build.

 

 


___________________
Try to take over the world!
Message 2 of 11
(5,280 Views)

Hi tst,

I tried your example #1, but it's not working: when I build the application, I believe I have to put the sub_vi.vi on the same folder as the .exe to have it executed, am I right?

Am I missing something?

Any help greatly appreciated.

Regards

 

0 Kudos
Message 3 of 11
(5,125 Views)

The first example assumes two things:

 

  1. There's a folder that has all the plugins.
  2. The actual plugin VI is included in the build (e.g. by putting it in the Always Included section, as shown below), so it's also placed inside the EXE.

If this is done, then the "plugins folder" VI shown in my example and the actual plugin VIs keep their relative positions inside the EXE, which is the case the original poster had. In this case, as well as in my second example, you don't have to do anything - LV will automatically place the VI in the correct place INSIDE the EXE.

 

I didn't look at your code, but if you're not including the plugin inside the EXE itself, this can become more complicated, because you have to manage all the paths and the dependencies. I suggest you try to avoid doing this unless you must have the ability to add plugins after building the EXE.

 

If you do need, try searching around for info on plugin architectures. I believe there's some info in the LV wiki.

 

build_specs.PNG


___________________
Try to take over the world!
0 Kudos
Message 4 of 11
(5,114 Views)

Thanks for replying.

 

"...unless you must have the ability to add plugins after building the EXE"

Unfortunately, thats' exactly my case Smiley Sad. But I have just one plugin, and final users (to whom I'm distributing the exe) should only place the plugin, whose nome must be always the same, on the same folder as the exe.

In few words, the final user will place his own VI, whose name will be "test.vi", on the same folder as the exe. Test.vi will produce only one "double" numeric as output, which should be read from the exe. I didn't think it was so complicated...

Thanks for your time

Regards

 

0 Kudos
Message 5 of 11
(5,110 Views)

LV 2009 has a VI called Application Directory which returns the path of the folder that the EXE is in. You should be able to use that.


___________________
Try to take over the world!
Message 6 of 11
(5,103 Views)

Thanks, it's in the openG library. And.. it's working!

Many thanks for your time and your help

Regards

0 Kudos
Message 7 of 11
(5,098 Views)

I wasn't refering to the OpenG VI. I was refering to an NI VI. The difference is that when called inside LV the OpenG will return the path where LabVIEW.exe is and the NI VI will return the folder of the project.


___________________
Try to take over the world!
0 Kudos
Message 8 of 11
(5,074 Views)

You're right...

Thanks again

0 Kudos
Message 9 of 11
(5,048 Views)

When you build the application try checking the "Use LabVIEW 8.x file layout" in the advanced tab.

 

Ben64

Message 10 of 11
(5,036 Views)