LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

dependency missing when I build exe

Solved!
Go to solution

I have a top-level VI that allows the user to point to a directory.  Inside that directory are several plug-ins that I want to be able to dynamically load into a subpanel during execution.  Each plug-in calls a few sub-VIs, along with some LabVIEW primitives (for this example, each plug-in calls Traverse for GObjects).  Traverse for GObjects shows up in my project dependency list inside the vi.lib folder.

 

When I run this program inside the IDE, it works fine.  However, when I build an exe and load the VIs into the subpanel, it never finishes loading.  The image of the front panel of the subVI shows up, but I can't interact with it.

 

I turned on the remote debugger and was able to view my block diagram while the executable was running.  Here's what I see where I should see Traverse for GObjects (see attached...a big question mark where the VI should be).

 

So I take that to mean that when I build the exe, I must not be including my dependencies correctly.  So I went into my build settings and have tried several things there, all to no avail.  The other thing I did was take the default Support Directory (called data in my case) and place it directly alongside my output executable...my understanding is that if the exe is looking for a given VI, it will first check its own directory.

 

I also tried - in the Source File Settings option within the build properties - I set the Dependencies destination to be my executable (i.e. select dependencies, check the box that says "Set destination for all contained items", then choose my exe from the drop-down...shouldn't that effectively build anything listed in 'dependencies' directly into the .exe??).

 

A couple of things puzzle me:

1. the obvious, what am I doing wrong?

2. why doesn't the exe give me an error when I run it if it can't find it (if this is a setting that hides error messages, how do I turn it off)?

 

Thanks in advance for any help.

0 Kudos
Message 1 of 7
(5,903 Views)

I'm still relatively new to VI scripting but I'm pretty sure that VI scripting functions are not available in the run time environment. You would have to call the dynamically loaded scripting code in an instance of the development environment, not the run time engine. I also found another forum here with a similar topic.

 

dK
0 Kudos
Message 2 of 7
(5,866 Views)
Solution
Accepted by topic author bmishoe

I have never tried to do this before so I hope this is correct.  The thing you want to do is compile all of the "plugins" into a packed project library.  And I believe all of the plugin's dependents need to be included there as well since the plugins don't have direct access to the files compiled within the EXE.  I'm sure someone will correct me if that isn't correct.  Smiley Wink

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 3 of 7
(5,864 Views)

sirknoxalot - That's a good thought but I know for a fact that Traverse is supported (unless something has changed in the past 24 hours).  I didn't go into detail in my original post but I have successfully created executables for this same application for 3+ years, albeit with a different approach to how the plugin got loaded (but the plugin itself remains the same and calls Traverse).

 

You are correct in that there are some functions - for instance Create GObject - that are not supported.

 

Thanks for the suggestion...

0 Kudos
Message 4 of 7
(5,861 Views)

aputman - I believe you are on track...I should have mentioned I found this article as well:

https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z000000PAq8SAG

 

Notice a potential problem descriptor is that the exe loads but fails to do anything.  I still don't understand though why I wouldn't be getting an error when it can't find the Traverse vi...

 

But setting that aside - I'm still not having luck even with following the instructions in the article.  I have gone so far as to create a temp directory, and inside that I put my executable and all the dependent VIs, including Traverse.., and the same thing still happens.  Surely the exe looks in its own directory?

0 Kudos
Message 5 of 7
(5,857 Views)

wrote:

sirknoxalot - That's a good thought but I know for a fact that Traverse is supported


That's good to know. Thanks!

dK
0 Kudos
Message 6 of 7
(5,832 Views)

For anyone curious as to how this works, here's the formula I ended up using.  I'm not saying this is the only way, or the right way, or anything other than, this is what worked for me.

 

  1. The first thing I did was try to accurately determine every sub-VI that the dynamic VI would need.  The dynamic VI calls a single VI…IP_wrapper.vi.  I right-clicked on IP wrapper and looked at its Sub-Vis, then I repeated the process for each of its Sub VIs.  This left me w/ what I hope is all the items that the dynamic VI will need to call.
  2. Having identified all of those SubVIs in step 1, I created a new library: view_support_lib.lvlib, and added all of the SubVIs (even those that show up in vi.lib inside Dependencies) from step 1 to it.
  3. Add a build specification for the lvlib:
    1. Right Click Build Specifications, New, Packed Library
    2. I chose ‘support lib’ as my build spec name
    3. Change the Target Filename to ‘view_support_lib.lvlibp’
    4. I left the Destination directory as builds\<prj_name>\My Packed Library
    5. On the source files tab, I set view_support_lib.lvlib as the top-level library
    6. I didn’t do anything on the Destinations tab or the Source File Settings tab
    7. Click Build and build the lvlibp
    8. Right-click on in the project explorer and add view_support_lib.lvlibp to the project
  4. Add a build specification for the exe:
    1. Right Click Build Specifications, New, Application
    2. I chose ‘default’ as my build spec name
    3. Change the Target Filename to ‘<your_exe_name>.exe’
    4. I left the Destination directory as builds\<prj>\default
    5. On the source files tab, I set the startup VI as <top_level_vi.vi>, and for always included I added view_support_lib.lvlib
    6. On the Destinations tab, I changed the paths as follows…( <prj>\builds for <top_level>.exe, and  <prj>\builds\support for the Support Directory)
    7. I did not change anything under Source File Settings
  5. Open up <dynamic_vi>.vi, and change IP_wrapper on the block diagram to the the IP_wrapper that’s inside the PPL we built in step 3
  6. Build the exe

 

This approach tells the exe that it can look in the support directory for the lvlibp that contains the dependencies.

 

Hope this approach works for you...

0 Kudos
Message 7 of 7
(5,805 Views)