![]() |
Constants can be defined within the IDL in either of the following ways:
- Within a module or interface.
- Globally, outside any module or interface.
If you declare an IDL constant within a module or interface, the constant is mapped as a static data item local to the C++ class for that module or interface. If you declare an IDL constant globally, the constant is mapped as a static data item global to that client application.
For example, consider the following IDL:
module M { const string name = "testing"; };After compiling the client bindings a C++ client application can refer to the constant using the expression M::name.
If the same constant is declared globally, outside any module or interface, then (after compiling the client bindings) a C++ client application can refer to the constant using the expression name.