DCE servers consist of two major portions of code: initialization code and manager code. All servers must perform some initialization prior to providing services and objects. In addition to initialization code, the server also has manager code that implements each interface that a server supports. The manager code contains the implementation of both the static and nonstatic member functions (or methods).
In an object-oriented development environment, there would generally be a server class with each server being an instance of that class. Although interesting and important for object-oriented applications, the design and implementation of such an environment is beyond the scope of this topic. However, there are a few issues to consider when initializing C++ servers, as follows:
· Server Registration
Servers are automatically registered by server stubs, so if your code calls the rpc_server_register_if( ) routine, you will get a
warning indicating the server is already registered.
· Entry point vectors (EPVs) and C++ function tables
When a C++ application is compiled, a function table is automatically generated for each class. The EPV
mechanism in DCE is necessary for languages that do not supply such a feature, such as C. Use NULL (the default EPV) for C++ applications.
· Named and persistent objects
Your server may need to create persistent or long-lived named objects before the server begins servicing client requests. Naming
objects is described later in this chapter.
· Exceptions
DCE supplies exception handling macros such as TRY, CATCH, and FINALLY for use in distributed applications. You should use DCE's
macros in your applications instead of the standard C++ macros to be sure exceptions are propagated properly from servers to clients.
See the first topic in the OSF DCE Application Development Guide - Introduction and Style Guide, for the typical steps DCE requires to initialize a server. The following topics describe features needed in manager code, the code responsible for a server's specific implementations of the interfaces supported.