07-22-2019 11:48 AM
I have 2 projects which currently exist on their own.
Let's call them project A and project B.
I am about to combine them into a single executable/project such that A will rely on B but B can exist on its own.
Now both A and B contain a common library C.
I am using git to version control everything and as things are now, project A contains library C and project B also contains library C. Library C is a git submodule.
Once I combine projects A and B this is the overall structure. Now project B is a git submodule when it is in project A.
How do I namespace this?
If I use a library in the project B folder to contain all the project B VIs and library C, then library C's files have to change to be in B's library and library C under B has to have it's own branch because it is different from library C under project A.
07-22-2019 12:37 PM
C should have its own library/libraries for namespace reasons. There is no reason to pull them in under B.
07-22-2019 01:31 PM
@crossrulz how would the final folder structure work then?
Like this? There is still a namespace conflict with this though.
07-22-2019 01:48 PM
In you exact setup, I would remove the C that is under A. C is already being used by B, which is used by A. Therefore A can just directly call the VIs in C.
07-22-2019 04:35 PM
That works I suppose. But is there a better solution? What if I want to use different commits of library C in each instance of it?
07-23-2019 09:45 AM
@JonathanMATech wrote:
That works I suppose. But is there a better solution? What if I want to use different commits of library C in each instance of it?
You'd have to make two (or three) projects, and compile parts in PPLs. I think that's the only way to use two VIs that have the exact same full name.
You'd be making your programming live very difficult...
07-23-2019 12:33 PM
@JonathanMATech wrote:
What if I want to use different commits of library C in each instance of it?
I'm not sure if I follow, but it sounds like you want to have 2 different versions of a re-use library in the same project? That sounds like a nightmare to maintain. I would try really hard to upgrade the code that is calling the older version of "C" so that it is compatible with the newer version. As to what this looks like on disk, it could be something like
Almost all of my projects have a Project\Re-use folder, which makes it pretty easy for LabVIEW to find the common code when trying to recycle a module into a different project. You don't have to do it exactly like this, think of a structure that makes the most sense to you. But, if you are consistent it will make it much easier to re-use parts of your code, and will even save you time navigating the file tree if all of your projects look similar.
02-28-2020 06:30 AM
@JonathanMATech I'm having the same kind of problem here. Is there a solution you have worked out until now?
If yes I would appreciate if you could share it.
02-28-2020 11:11 AM
My reuse libraries are created and maintained as a separate project. When the reuse library is finished, I make a VIPM package out of it and install it to my computer. Other projects that use the reuse library use the "installed" version in my vi.lib folder, not the project folder.
04-21-2020 05:00 PM - edited 04-21-2020 05:00 PM
@Martin-G
No I have not found a great solution.
The answers given are helpful, just not exactly what I was (and am) hoping for.
Yes I understand having 2 versions of the same library in the same project could be difficult to maintain but it would be nice if it were possible.