OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
Step 2: Creating an application dictionary

When a DLL is used by more than one application or process, it must maintain multiple copies of the global, static, and dynamic variables that represent its current state in each process.

For example, the DLL version of ObjectWindows maintains a dictionary that allows it to retrieve the owl::TApplication object which corresponds to the current active process. If you turn your application into a DLL server, the application must also maintain a dictionary of the owl::TApplication objects created as each new client attaches to the DLL. The DEFINE_APP_DICTIONARY macro provides a simple and unified method for creating an application dictionary object. Insert the following statement with your other static variable declarations.

#define DEFINE_APP_DICTIONARY(AppDictionary)
Convenient macro to define a 'AppDictionary' ref and object as needed for use in component DLLs and E...
Definition appdict.h:93

The DEFINE_APP_DICTIONARY macro correctly defines the AppDictionary variable regardless of how the application is built. in applications using the static version of ObjectWindows, it simply creates a reference to the existing ObjectWindows application dictionary. for DLL-servers using the DLL version of ObjectWindows, however, the macro declares a instance of the TAppDictionary class. It is important to use the name AppDictionary when creating your application dictionary object. This allows you to take advantage of the factory template classes for implementing a factory callback function.