05-05-2010 08:34 AM
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:
The 'AutoPath' VI:
Info received when trying to call subvi from BUILT exe:
Finally, project structure (auto-populating directories) and build spec's:
What is it that I'm not getting here?
Thanks for reading,
Jamie
05-05-2010 09:39 AM
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:
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.
10-01-2010 04:08 AM
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
10-01-2010 04:59 AM
The first example assumes two things:
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.
10-01-2010 05:07 AM - edited 10-01-2010 05:08 AM
Thanks for replying.
"...unless you must have the ability to add plugins after building the EXE"
Unfortunately, thats' exactly my case . 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
10-01-2010 06:24 AM
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.
10-01-2010 06:40 AM
Thanks, it's in the openG library. And.. it's working!
Many thanks for your time and your help
Regards
10-03-2010 11:17 AM
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.
10-04-2010 07:08 AM
You're right...
Thanks again
10-04-2010 08:41 AM