Discussion:
Problem executing dynamically loaded plug-in .vi's from .exe in run-time environment.
(too old to reply)
Jarrod S.
2006-05-11 23:40:08 UTC
Permalink
Hi Mike, I've been working on a method that I hope should work for this application. I haven't been able to test it on a computer that doesn't have the LabVIEW development system installed, but I have come across the same type of missing VIs errors that you experienced in some of my earlier tries, so I hope this will resolve them.What I would suggest to you is to build your dataplugin VIs into executable packages, even if you don't intend to ever double click and launch those executables. The idea is that by building them into that type of package, LabVIEW will package them with all the DLLs and subVIs they require to run. Then you can launch the VIs by opening references to them at directories like myapp.exe\myVI.vi or whatever. You can also use the List Directory advanced file function to search for VIs in the myapp.exe directory.The only problem here is that you'll not only find the dataplugin VIs you want with that method, but also all their subVIs. It might be difficult to separate the few VIs you do want from the dozens of subVIs you don't want to open references to and launch. So I have a solution for that too.My first idea was to build the executable, but include the dataplugin VIs of interest in the destination directory instead of the exe package itself. This sort of works. Although this makes it easy to find the VIs of interest, when you open up a reference to the VIs and open their front panels, the run-time engine will have to search for the subVIs which are contained in the exe. Since they're all in the same folder, they will be found, but you'll see that searching dialog which pretty much strikes this as a possibility.Instead, the better option is to include all your dataplugin VIs in one or more Project Libraries. Then include the whole Project Library under Startup Vis in your build spec. When you build the package, LabVIEW will include all the necessary subVIs and DLLs, as well as the .lvlib file itself that contains the names and paths of the relevant dataplugin subVIs. Your app that calls the dataplugins could then search the exe file for *lvlib files (or better yet, give them some sort of identifiable name to distinguish them, like DataPlugin*.lvlib), open references to the Project Libraries, and then derive the VI references from there.I know this might be a lot to take in, but the end result is a rather robust solution to the problem, where all the linking requirements are taken care of. It also provides a rather easy way to package your dataplugins. Just throw them all in a Project Library called DataPlugin*.lvlib or whatever, then build the whole thing with the library set as the Startup VI.I'll attach an example below. Again, I haven't tested this on a non-LV machine, but I can only imagine it would work, since at that point the exe file with the dataplugins should be completely self-sufficient. Let me know how this works out, or if you have any advice to improve on this!Just unzip the dataplugins zip file. That contains the project with the library with the plugins and the correct build spec. Build that exe, then take a look at Caller.vi, which searches through the exe for Data*.lvlib files and opens references to all its VIs. Hope this helps!


DataPlugins Project.zip:
http://forums.ni.com/attachments/ni/170/184471/1/DataPlugins Project.zip


Caller.vi:
http://forums.ni.com/attachments/ni/170/184471/2/Caller.vi
MikeTex
2006-05-16 21:10:09 UTC
Permalink
Hi Jarrod, Unfortunately, I'm still floundering. I've tried to implement your workaround and haven't succeeded.My main application does not make any calls into the NI_AALBase.lvlib so it was not included as a dependency. To make trying your scenario easier, I dropped a Mean.vi onto my block diagram to force the dependency. I then moved the NI_AALBase.lvlib from the Dependencies section to the main section of the project (see enclosed Project.bmp).I rebuilt the EXE. Then I adjusted my Source Distribution to force NI_AALBase.lvlib to be included (see Source Dist.bmp).I only saw one reference in the collection of distribution files to NI_AALBase and it was a file called NI_AALBAse.lvlib which was only 1k in size (see Files.bmp). The standard file in vi.lib is 26k. My EXE file didn't grow so I don't think the VI's from the library are being embedded within it.Attempting to run this distribution on the target machine produces three error dialog boxes:"LabVIEW: Generic error.The file 'lvanlys.dll' is not a valid LabVIEW file."then:"LabVIEW: Resource not found.An error occurred loading VI 'NI_AALBase.lvlib:Mean.vi'LabVIEW load error code 3: Could not load front panel."then:"Missing subVI NI_AALBase.lvlib:Mean.vi in VI EPW.vi."After this, my main VI will not even run and shows the broken "list errors" arrow.Is there anything obvious to you that I did wrong with your workaround?Mike


Files.JPG:
Loading Image...


Project.JPG:
Loading Image...


Source Dist.JPG:
http://forums.ni.com/attachments/ni/170/185232/3/Source Dist.JPG
MikeTex
2006-05-16 21:40:09 UTC
Permalink
Hi Jarrod, Ok, I tried the workaround with the plug-in.Only 4 small files were created with the Source Distribution. I've enclosed the screen shot.The main application starts fine, but the plug-in still fails. When I click the "list errors" arrow I get:"The VI is not executable. The full development version of LavVIEW is required to fix the errors."MikeMessage Edited by MikeTex on 05-16-2006 05:35 PM


Files.JPG:
Loading Image...


Project.JPG:
Loading Image...


Source Dist 2.JPG:
http://forums.ni.com/attachments/ni/170/185238/4/Source Dist 2.JPG
Jarrod S.
2006-05-17 18:10:08 UTC
Permalink
Hi Mike,I really hope we should be getting closer to the solution. One last setting to check that I didn't see in your screenshots. Under the Distribution Settings category for the Source Distribution, you should have Exclude vi.lib unchecked and Disconnect Type Definitions and Remove Unused Polymorphic Instances unchecked.That last item is what actually determines whether LabVIEW includes an abridged library with only the referenced files or all the files in the library. If it's unchecked, LabVIEW will include the whole library. I'm honestly not sure, though, why no VIs except the main VI were included in your build. Could you perhaps zip this project and post it?
<img src="Loading Image..."> Message Edited by Jarrod S. on 05-17-2006 12:54 PM


Source_Dist_Setting.JPG:
http://forums.ni.com/attachments/ni/170/185470/1/Source_Dist_Setting.JPG
Loading...