Write the server-side code

EAServer Manager has generated C++ implementation templates for the component methods. Here we will fill in the implementation template, then build a shared library or DLL file. Finally, we will verify that the shared library or DLL is in the EAServer cpplib subdirectory, where EAServer expects to find C and C++ component library files.

StepsWriting the server-side code

  1. Navigate to the cpplib directory under your EAServer installation, then navigate to the Tutorial/CPPArithmetic subdirectory. You should see the following files:

  2. Rename the implementation files to CPPArithmeticImpl.hpp and CPPArithmeticImpl.cpp. (In other words, remove the .new extension from both file names).

  3. Open CPPArithmeticImpl.cpp in a text editor, then find the definition of the multiply method. Change the definition so that it matches the one below:

    CORBA::Double CPPArithmeticImpl::multiply
        (CORBA::Double m1,
        CORBA::Double m2)
    {
        CORBA::Double result;
        result = m1 * m2;
        return result;
    }
    
  4. Save your changes.

StepsBuilding the component on Windows

  1. Verify your setup as described in “Verify your environment”.

  2. Rename make.nt to Makefile, then open Makefile in a text editor. Find the definition of the ODBCHOME macro:

    ODBCHOME=d:\msdev
    
  3. Change the ODBCHOME definition to match the directory where you have installed Microsoft Visual C++, for example:

    ODBCHOME="D:\engapps\devStudio\VC98"
    
  4. Save your changes.

  5. Build the DLL by running nmake (no arguments are required).

You should see a new file called libCPPArithmetic.dll. Verify that the makefile has copied this file to the EAServer cpplib subdirectory. If nmake fails, verify that you have renamed the .cpp and .hpp implementation files with the expected file names, and that you have applied the correct edits to CPPArithmeticImpl.cpp and Makefile.

StepsBuilding the component on UNIX platforms

  1. Verify your setup as described in “Verify your environment”.

  2. Rename make.unix to Makefile.

  3. On Solaris, the make file is compatible with the Solaris CC compiler, version 6.x. If you use a version 4.x compiler, edit Makefile and change -L$JAGUAR/lib to -L$JAGUAR/lib_sol4x. You must use the compiler version that is compatible with your server. The default server binary requires libraries compatible with the 6.x compiler, but you can override this setting when starting the server. For more information, see “Starting the server” in the EAServer System Administration Guide.

  4. Build the shared library by running make (no arguments are required).

You should see a new file called libCPPArithmetic.ext, where ext is the appropriate shared library extension for your platform. Verify that the makefile has copied this file to the EAServer cpplib subdirectory.

If make fails, verify the following: