Rogue Wave banner
Previous fileTop of DocumentContentsIndexNext file

27.7 Passing Non-Opaque Parameters

This section provides information on passing parameters of various non-opaque types through an IDL interface via Orbix.

27.7.1 Integers

IDL does not support the int type due to differences in system-dependent integer sizes. However, the orb library must support ints and unsigned ints, since the orb library classes inherit from the virtual stream abstract base classes, which define virtual insertion and extraction operations, and do take integer arguments. Integers are supported in the orb library classes by passing the value as a long and then casting it back to an integer on the far side. If the passed integer exceeds the bounds of integers on the target platform, then the stream is put into a fail state and a marshal exception is raised. It would be best if you could avoid using integers altogether and use explicit short or long ints instead.

27.7.2 Overloading

Compilers differ in their treatment of unsigned char and wchar_t, or wide characters. Some compilers cannot tell the difference between unsigned chars and chars, and may implement wchar_t types as typedefs. Thus, if you have a method that is overloaded on both wchar_t and the type that it is typedefed to, or unsigned char and char in the case of compilers that cannot tell these two apart, the compiler cannot distinguish the overloaded methods. Rogue Wave's solution is to #ifdef out any code, including virtual stream method declarations, referring to ill-supported types.

The fact that compilers on different platforms may support types differently presents a problem for the orb library, as its purpose is to facilitate the passing of user-defined objects in a heterogeneous environment. The orb library can support these types in the local environment. Across a CORBA interface, however, one side may have knowledge and make use of the non-ubiquitous type, while the other may not. This problem manifests itself as an error when compiling the class on the side which handles the type in the less than ideal manner. In light of this, if you must use these types in your classes, the best solution is to cast them to or from some compatible type in your virtual stream insertion and extraction operators. For example, unsigned char can be cast to and from char or short, and wchar_t can be cast to and from long.

27.7.3 Nil Pointers

In Orbix 2.1 it is illegal to pass a nil opaque pointer.



Previous fileTop of DocumentContentsIndexNext file

©Copyright 2000, Rogue Wave Software, Inc.
Contact Rogue Wave about documentation or support issues.