CORBA 2.6.1 Getting Started Guide for C++

Chapter 4. Running the C++ Stack Example
Chapter 4. Running the C++ Stack Example
The Stack Example Overview
Building the Stack Example
Configuring NonStop CORBA for the Stack Example
Running the Stack Example on OSS
Using the Stack Example With IIOP/SSL
Once you have installed your NonStop CORBA software and configured your system, you can test the operation of your system by running a
simple CORBA program.
The stack example is a simple but working CORBA program that has both a client and a server implemented in C++ and in Java. This section
describes the C++ version of the example. Because it contains both client and server applications, the Stack example is a perfect test for your
newly installed NonStop CORBA system.
The Stack Example Overview
The Stack example resides in the samples/stack subdirectory of your NonStop CORBA installation. While the intent of this topic is to test your
installation, the
README file in the stack directory describes the workings of the program files.
The Stack example is a program that implements both a CORBA client and server in C++. It is a complete and working program that
demonstrates:
An object interface definition written in the Interface Definition Language (IDL)
A POA server that embodies the implementation of the interface defined by the interface definition
A client application which makes use of an instance of a stack object
In addition to these items, you can use the Stack example to demonstrate both portability and interoperability. To demonstrate portability, you
can move this example to another platform that is running an implementation of CORBA. To demonstrate interoperability, you can build and run
the client application on one platform, then run the client with the server application built on another platform.
Building the Stack Example
The stack example contains a file named Makefile which builds both the client and server applications. Makefile performs the required steps to
construct the executable components. Macros that are used in the
Makefile are defined in etc/macros.mk.
To build the sample:
1. Log on to the system and go to the
samples/stack directory.
2. Verify that the
etc/env.sh script has been sourced.
3. Run the
Makefile in the samples/stack directory.
The
Makefile:
Uses the NonStop CORBA IDL compiler to process the interface contained in stack.idl.
Builds the server executable by using the C++ compiler to compile the server components.
Builds the client executable by using the C++ compiler to build the server components.
The NonStop CORBA IDL compiler nsdidl, takes stack.idl file as input and produces the following four files:
stack_client.h
stack_client.cpp
stack_server.h
stack_server.cpp
These files contain the CORBA-specified C++ language-mapping translation of the interface definition provided in the stack.idl file. Client
programs use the
stack_client components to implement the client interface, and server programs use the stack_server components to
implement the server interface.