background image
Bionic Buffalo Tech Note #20: Quick Start Guide to Writing CORBA Client Applications 
CORBA_exception_value() or CORBA_exception_as_any() may be used to learn the
value of the exception. 
For more details on exception handling, consult the language mapping specification for the
programming language you are using, or documentation from your 
ORB supplier. 
Acquire a reference for the server object or objects. There are, as was explained earlier, various
ways to acquire references to server objects. The choice of mechanism will depend on the way the
system was designed, and on how the server has chosen to advertise its objects or otherwise to make
them available. 
The complexity of the various ways to acquire references varies greatly. The mechanism may consist
of a single subroutine call (such as 
string_to_object()), or it may involve an iterative
procedure or sequence of such procedures. Because of the variety and sometimes complexity, the
different mechanisms cannot all be described in this short Tech Note. The application programmer is
referred to the material listed in the Bibliography below. 
Do the primary activity of the application. Once there is in hand a reference to a server object, the
application may commence invocation of operations or attribute calls on that object. 
Using the stubs generated by the compiler, invocations of operations on objects look the same to the
application program as ordinary local subroutine, procedure, or function calls. The stub routine serves
as a local proxy for the object, whether that object is in the same application or whether it is remote
and accessible only via the network. 
For CORBA programming, however, there are some rules and guidelines, however, which will help to
avoid some problems and difficulties: 
1.  Check for exceptions wherever they might occur. 
2.  Do not look inside or assume knowledge of things which are supposed to be opaque. For example,
even if you know how to decompose or duplicate an object reference, do not do it: use the system
provided operations instead. 
3.  In language mappings (such as C) which include memory and other resource allocation and release
functions, use the specific, provided functions instead of generic functions. For example, to allocate
a structure 
X in C, use X__alloc() instead of malloc(). 
4.  In threaded programs, do not share thread-specific system data (such as the
CORBA_Environment pointer in C) among threads. 
5.  In threaded (and sometimes other) programs, be aware that calls to object operations may block,
even when the object is local and no network activity is required. 
6.  Do not bypass the language mapping rules. For example, a close reading of the C mapping
specification shows that, while IDL 
long is mapped to CORBA_long, there is no requirement that
Page 8 of 11