[Enterprise Extensions only]

Creating CORBA server main code (server.cpp), adding include statements and global declarations

Use this task to add the include statements and global declarations needed to the source file for a CORBA server main code. This task is one step of the parent task to create the CORBA server main code, as described in Creating a CORBA server main code (server.cpp).

To add include statements and global statements to the source file for a CORBA server main code, edit the server source file, servantServer.cpp, and add appropriate statements:

  1. Add appropriate include statements; for example:
    #include "servant.ih"
    #include "servershutdown.h"
    
    #include <CosNaming.hh>

    Where:

    servant.ih
    Specifies the name of the implementation header file for the servant class, servant, to be hosted by the server.
    servershutdown.h
    Specifies the name of the header file for the class used to shutdown the CORBA server.
    CosNaming.hh
    Specifies the header file for the COSNaming functions.

  2. Add appropriate global declarations; for example:
    // Global declarations:
    static ::CORBA::ORB_ptr op;
    static ::CORBA::BOA_ptr bp;
    ::CORBA::ImplementationDef_ptr imp ;
    servant_var object_Impl;

    Where:

    ::CORBA::ORB_ptr op
    Declares a pointer to the ORB.
    ::CORBA::BOA_ptr bp
    Declares a pointer to the BOA.
    ::CORBA::ImplementationDef_ptr imp
    Declares a pointer to the ImplementationDef associated with the server alias.
    servant_var object_Impl
    Declares the servant object to be created later in the server main code.

You can add the code for the functions needed in the server main code, as described in the parent task Creating a CORBA server main code (server.cpp).