We have a common PBL (common.pbl) that is used by three different applications. Each application declares some global variables of types of user objects in the common PBL.
Objects in the common PBL need access to some of those same global variables, so our design was that they get injected into the objects with of_initialize functions (for user objects) or as PowerObjectParms with OpenWithParm for windows.
So for instance one of the global variables that instantiates a common PBL object is called gMsg (a custom messagebox). To inject it into a window in the common PBL, we would OpenWithParm(windowName, gMsg), and in the window, declare an instance variable iMsg of the same type, and in the Open event, do iMsg = Message.PowerObjectParm. Then whenever we need that in that window, just use iMsg.
We did that because we compile the common PBL separately (so each app doesn't always have to do so), using a separate tiny common application PBL (commonapp.pbl). The application object common.sra in commonapp.pbl doesn’t contain declarations of the same global variables. So commonapp.pbl and common.pbl together wouldn't compile if any objects in common.pbl referred directly to the main applications' global variables.
Then we use only common.pbd, compiled as above, in each of the three real applications. (Commonapp.pbl is only used for the separate compilation of common.pbl.)
But it just occurred to me that I can declare global variables in common.sra using the same names and data types as the individual application's application objects do - such as gMsg mentioned above. Then all other objects in commonapp.pbl could just refer to the global variables by their normal names, and it would work whether for compiling commonapp.pbl along with common.pbl separately, or when using common.pbd as part of the actual applications.
Does anyone see any problem with this change, like reasons why the global variables with the same names in the application object in commonapp.pbl and the real applications' application objects would not be seen as being the same?
Thanks.