08-19-2020 09:24 AM
As much as I hate to take your thread off topic, you appear to have an answer so...
Can someone explain access scope of a library?
Generally what, how, and why is it?
Why is this or that "public" or "private" and what does that mean?
08-19-2020 09:39 AM
@RTSLVU wrote:
Can someone explain access scope of a library?
Generally what, how, and why is it?
Why is this or that "public" or "private" and what does that mean?
Private: Only other items in the library can access it
Public: Anybody can access it
It works the same for libraries as it does for VIs and controls. If a library is private, only items inside of the parent library can access it. A library cannot be a top level and set its scope. For example, we have top level library Parent. It has children libraries A and B. If A has a VI inside of it set to private, only items in A can access it. If A is set to private, then B can still access all of the public (relative to A) VIs inside of A, but C (not being inside of Parent) cannot access anything from A.
I recently did this with classes as I wanted some encapsulation for 3 parts of the library, but didn't want anybody outside of the library to be able to access those classes. Those classes are specific to a QMH inside of the library. So Driver.lib has classes A.lvclass, B.lvclass, and C.lvclass set to private with a bunch of API VIs that are public to command the QMH to do something with those classes.