From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

dynamically load a vi (source code) from an exe

I am trying to build an application where the exe version will call some source code vi's and execute them. to be more clear, i am trying to call a vi (soucre code) from an exe build using labview using the full path information. I am attaching the diagram of this part as an image. It works fine in source code mode but does not work in exe version
0 Kudos
Message 1 of 14
(4,614 Views)
The error code i am getting is 1003 ==> labview code is not executable. But i have no problem when i try to open the vi in labview ide.

Anand.
0 Kudos
Message 2 of 14
(4,614 Views)
In the VI that you're trying to call, are there any subVIs in there? You may have to do an development or application distribution and create an llb that contains everything that the VI needs. You could also include these files when you build the main application.
0 Kudos
Message 3 of 14
(4,616 Views)
Dennis,
The vi has subvi's. But my main idea is to have an application (EXE) dynamically call these vi's (source code). I dont want it to be a part of the exe itself (i.e. i dont want to add it as a dynamic vi when building exe). If i added the vi's as dynamic during application build, i have no problem. But i want to have a part of my program wich will never change to be an exe and other part which constantly changes to be an scource code. is there anyway to do it? i am getting an 1003 error if i open a vi reference to it. is it bcos the exe version only knows to read from llb's?
0 Kudos
Message 4 of 14
(4,616 Views)
A dynamically called VI has to be executable by itself and that means all of it's subVIs have to be present. You have to either include the subVIs in the executable or include them in a llb. What I normally do is distribute the VI I want to call and an llb that contains all of the VI's subVIs. You could also distribute all of the VI's subVIs individually. You can still do what you want but only if you provide all of code in some way.
0 Kudos
Message 5 of 14
(4,616 Views)
Anand,

This type of thing has been done many times before. Try going to www.openg.org and download their modified application builder and their loader. The loader is what you are looking for. It is an executable that will launch other VIs outside of itself.

Randy Hoskin
Applications Engineer
National Instruments
http://www.ni.com/ask
0 Kudos
Message 6 of 14
(4,616 Views)
Dennis is right. SubVIs are probably not found where expected in the VI's hierarchy. This often happens when VIs from VI.LIB are called. By default, your executable expects VI.LIB to be in the executable directory. Then you have to either save all VI subVIs in a lib/dir (save with options>Distribution) or change the options in the executable to set VI.LIB location to your LabVIEW development directory.


LabVIEW, C'est LabVIEW

0 Kudos
Message 7 of 14
(4,616 Views)
Thanks for your suggestions. I guess the problem was with path. Once i added vi search path to the ini file for the exe, the program now works fine. It was probably the vi library files that were missing.

Thanks,
Anand.
0 Kudos
Message 8 of 14
(4,616 Views)
I'm creating a test shell program which calls test vi's dynamically. I want to make an exe version of the shell but keep the tests as vi's. The problem I was having that was that the test vi's would not load becuase the vi.lib directory could not be found. Thanks to this forum thread I now understand that. My question now is how to fix this. What is the easiest way of including the vi.lib directory in the EXE so that the plug-ins can locate it? I'd like to find a solution that doesn't force the test vi's to contain the vi.lib files, but instead includes all the vi.lib files in the EXE.

Thanks in advance:)
0 Kudos
Message 9 of 14
(4,496 Views)
Hello ejb,

If I understand you correctly, you want to include all of the vi.lib VIs in your executable? I can't help but think that this would make your exe file awfully and unnecessarily large. Why don't you want to use any of the two solutions mentioned above (and listed below):

1) Include the vi.lib path to the exe.ini file as a VI search path. You can do this by adding the following to your exe.ini file. (also, you can see how your LabVIEW environment saves the VISearchPaths by searching for this token in your LabVIEW.ini file)

viSearchPath="C:\yourdirectory ; C:\anyotherdirectory ; C:\anyotherdirectory ; etc."

2) Make the VIs that you are trying to call part of an LLB, which also contains the subVIs (including vi.lib VIs) needed for execution.

Is there a reason why you do not want to use any of these solutions?

Hope this helps,
Travis H.
LabVIEW R&D
National Instruments
0 Kudos
Message 10 of 14
(4,478 Views)