Jump to content

VI's with the same name in built executables


Recommended Posts

Hi,

Now that LV8 is out we are using VI's with the same name but in different libraries (.lvlib's). This is a big advance for us -- multiple modules can have subVI's with the same name (i.e. initialize.vi) so long as they are in different name spaces (libraries). This avoids all sorts of problems we have been having previously with name conflicts. The modules I am speaking of are dynamically loaded at runtime by the VI Server. This all works works very well when running the development environment. When we build an application (installer) and install it on another host and run from the executable, it fails completely. If I rename the executable to a .llb and look at the contents, I see that all of the VI's are at the top level and VI's with the same name have been renamed. For example: lib1.lvlib:init.vi, lib2.lvlib:init.vi, lib3.lvlib:init.vi get renamed to init.vi, init0.vi, and init1.vi and the library XML files get updated accordingly when the executable gets built. The problem comes when we try to refer to the VI's by name to load them via the VI Server. What is the best way to sort out in what order they were renamed? I can still navigatge the library tree (XML files) and try all the possible renaming scenerios but this gets terribly complicated, especially if I already had a VI named init1.vi in one of the affected libraries. Is it generally a good idea to avoid VI's with the same name even if they are in different libraries? :unsure:

--Lee

Link to comment
If I rename the executable to a .llb and look at the contents, I see that all of the VI's are at the top level and VI's with the same name have been renamed. For example: lib1.lvlib:init.vi, lib2.lvlib:init.vi, lib3.lvlib:init.vi get renamed to init.vi, init0.vi, and init1.vi and the library XML files get updated accordingly when the executable gets built. The problem comes when we try to refer to the VI's by name to load them via the VI Server. What is the best way to sort out in what order they were renamed?

Lee,

Project libraries and namespaces are great but you do run into a problem when we try to stick all those VIs of the same name into the same folder (or .llb) on disk. So what to do, should App Builder error out about the file already existing? Not everyone is calling code in their .lvlibs dynamically so they don't care if the files get renamed and the static calls get relinked, as long as the code still works. We decided to rename them if they are going to the same location and report a warning instead of an error:

A name collision occurred during the build. VIs were renamed to protect the build. If any dynamic calls were made to the following VI, unexpected behavior can occur:

C:\Documents and Settings\kennonc\Desktop\New Folder\asdf.vi

The warning appears in the dialog when the build finishes but you have to click the twistie to see it. This will tell you what was renamed after the fact, which doesn't help your code looking for the dynamic VI. I'd advise against trying to figure out how things get renamed, it depends on where the VI is in your hierarchy which of course can change and would be hard to keep up with.

So what I recommend is building each project library into its own destination. You can create multiple destinations with App Builder and in 8.0 choose which VIs go into which location. I think a .llb per .lvlib might be in order. You can create the destinations as .llbs right next to your exe or in a sub folder on the Destinations page and then on the Source File Settings page set the .lvlib to go to that destination and check the box to set the destination for all contained items.

Now since you are calling VIs in the .lvlib dynamically, you'll need to modify the location you look for them at based on whether or not the call in VI is in the run-time system or development environment. This would be information to include in the instructions on how to use your .lvlib

Another thought is to have a VI in your .lvlib that does the dynamic call, but has a unique name that your code outside the .lvlib calls statically. This would be okay if you only have a couple of dynamic calls but would get out of hand if you had a lot of them.

Is it generally a good idea to avoid VI's with the same name even if they are in different libraries? :unsure:

I don't want to give up on namespaces yet, so I'll say no, but that would make things easier in this situation.

Kennon

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.