CORBA 2.6.1 Programmer's Guide for C++
Table Of Contents
- HP NonStop CORBA 2.6.1 Programmer's Guide for C++
- New and Changed Information
- Legal Notice
- About This Guide
- Chapter 1. Introduction to NonStop CORBA Programming
- Chapter 2. NonStop CORBA Administrative Environment
- Chapter 3. Compiling and Building an Application
- Chapter 4. Deploying a NonStop CORBA Application
- Chapter 5. Tracing and Debugging Applications
- Chapter 6. Writing Scalable Applications
- Chapter 7. Managing Transactions
- Chapter 8. Writing Multithreaded Applications
- Chapter 9. Designing Advanced Applications
- Chapter 10. Porting CORBA Applications to NonStop CORBA
- Chapter 11. Using the IIOP/SSL API
- Chapter 12. Writing Wrappers for Legacy Clients and Servers
- Appendix A. Architectural Walkthrough
- Appendix B. Object References
- Appendix C. Servant Reference Counting in NonStop CORBA
- Index

Tips for Building NonStop CORBA Application Components
1. Ensure that the $NSD_ROOT/etc/env.sh file was sourced into the OSS shell environment.
2. Run the NonStop CORBA IDL compiler on all your IDL files to produce header files, client stub files, and server skeleton files. For more
information, see
Using the IDL Compiler.
nsdidl -language C++ *.idl
Note:
Do not modify the compiler-generated files.
Write your own header file that includes the
_server.h header generated by the IDL compiler. Make your
interface implementation class inherit from the POA_interface class found in _server.h. Implement the pure
virtual functions that are declared for this class.
3. Write the client program, server program, and object implementation. Your client program must include language-specific header files for
the objects it will use.
4. Compile all the source code files, including generated ones, using c89 to produce .o files.
5. Build the client and server executables by linking the
.o files with the NonStop CORBA shared run-time library (SRL).
Makefiles
The NonStop CORBA sample programs use a Makefile to perform the steps involved in building an application. The Makefile describes the
program dependencies in such a way that all you have to do is run the
make command to build all the components of the application. For
example, to build the Stock sample application, be sure you are in the directory containing the copy of the Stock sample, type:
make
This command builds the interface, the server, the implementation, and finally the client.
To see examples of how you might use Makefiles, refer to the sample programs shipped with the NonStop CORBA product. The source code
for all the samples is in the
samples directory. The directory for each sample contains a file called Readme, which describes how to build,
configure, and execute that sample program.
The sample Makefiles use two files that are shipped with NonStop CORBA, macros.mk and rules.mk, which reside in the $NSD_ROOT/etc
directory. The macros.mk file defines macros, and rules.mk defines dependency rules that are useful for building any NonStop CORBA
application.
The samples vary in complexity and illustrate how to use different NonStop CORBA features, such as the Naming and Event Services, stateful
and stateless objects, application data in a NonStop SQL/MP database, and writing multithreaded applications.
Note:
The
make utility is vital in combining your program modules into a coherent application and enabling you to maintain
individual modules. For detailed information, refer to the Open System Services User's Guide and to the
Make (1)
utility reference page either online or in the Open System Services Shell and Utilities Reference Manual.
Special Considerations for Building Transactional Clients and Servers
When building a transactional CORBA application with the Object Transaction Service (OTS), it is necessary to have access to the
CosTransactions::Current interface and a communications stub for the NonStop Transaction Manager (NSotsTM process). During development
you accomplish access by including declarations from the file
CosTransactions.idl and deriving objects that execute within transactional
boundaries from
TransactionalObject. Note that TransactionalObject will be replaced in the future by the OTSPolicy component.
When building a C++ application, you accomplish access by including the file
$NSD_ROOT/lib/nsdots.o in the link step. To see an example of
building a transactional client and server, consult the
ots_bank sample program.
See
Managing Transactions for additional information and design considerations for transactional applications.
Using the IDL Compiler
This section describes the NonStop CORBA Interface Definition Language (IDL) compiler. You use the IDL compiler to generate language
bindings from the interface definitions you have written in IDL for your CORBA application. (The NonStop CORBA IDL compiler was
implemented using the ANTLR parser-generator. For information about ANTLR see
www.antlr.org.)
IDL Compiler Processing
To simply run the NonStop CORBA IDL compiler alone, you invoke the $NSD_ROOT/bin/nsdidl script with options and specify one or more IDL
files. These files contain IDL definitions and can also include preprocessor directives. Refer to
IDL Compiler Syntax for a complete description of
the
nsdidl command and associated options.
Preprocessing
OMG IDL preprocessing uses an ANSI C++ preprocessor to provide macro substitution, conditional compilation, and source-file inclusion.
Preprocessor directives can also provide line numbering for diagnostic messages and symbolic debugging, and support implementation-
dependent actions (the
#pragma directive). Preprocessing directives begin with a pound sign (#). Consult your ANSI C++ preprocessor