TypeCode constants

TypeCodes are actually available in two forms: In addition to the TypeCode information provided by the methods of the Interface Repository, TypeCode constants can be generated by the SOM Compiler in your C or C++ usage bindings upon request. A TypeCode constant contains the same information found in the corresponding IR TypeCode, but has the advantage that it can be used as a literal in a C or C++ program anywhere a normal TypeCode would be acceptable.

TypeCode constants have the form TC_< typename>, where <typename> is the name of a type (that is, a typedef, union, struct, or enum) that you have defined in an IDL source file. In addition, all IDL basic types and certain types dictated by the OMG CORBA standard come with pre-defined TypeCode constants (such as TC_long, TC_short, TC_char, and so forth). A full list of the pre-defined TypeCode constants can be found in the file "somtcnst.h". You must explicitly include this file in your source program to use the pre-defined TypeCode constants.

Since the generation of TypeCode constants can increase the time required by the SOM Compiler to process your IDL files, you must explicitly request the production of TypeCode constants if you need them. To do so, use the "tcconsts" modifier with the -m option of the sc or somc command. For example, the command

sc -sh -mtcconsts myclass.idl         (On AIX or Windows)
somc -sh -mtcconsts myclass.idl       (On Windows)

will cause the SOM Compiler to generate a "myclass.h" file that contains TypeCode constants for the types defined in "myclass.idl".


[Back: Using the 'tk_foreign' TypeCode]
[Next: Using the IDL basic type 'any']