TAO IDL Compiler User's Guide

Scope

This document describes the options and features of TAO IDL compiler. It is not a reference manual or tutorial on OMG IDL. For more information on OMG IDL see the online CORBA specification and the Advanced CORBA Programming with C++ book. More information on the design of TAO's IDL compiler is also available online. Finally, comprehensive documentation on TAO's IDL compiler is available in the OCI TAO Developer's Guide.


Optional CIAO Functionality

For users of the Component Integrated ACE ORB ( CIAO), it is important to note that, in keeping with recent developements in the OMG's Lightweight CORBA Component Model ( LwCCM) specification, CIAO's Component Implementation Definition Language (CIDL) compiler, along with the .cidl files it processed, have been eliminated, and replaced by additional functionality in the TAO IDL compiler. All the additional files generated and command line options used are described below.

Generated Files

The IDL compiler generates up to 16 files from each .idl file. The file names are obtained by taking the IDL basename and appending the following suffixes (see the list of TAO's IDL compiler options on how to get different suffixes for these files:)

TAO's IDL compiler creates separate *.inl and *S_T.* files to improve the performance of the generated code. For example, the *.inl files enable you to compile with inlining enabled or not, which is useful for trading-off compile-time and run-time performance. Fortunately, you need to #include only the client stubs declared in the *C.h file and the skeletons in the *S.h file in your code. Inline files are not generated for CIAO servant or executor implementation code.


Environment Variables

Variable Usage
TAO_IDL_PREPROCESSOR Used to override the program name of the preprocessor that TAO_IDL uses.
TAO_IDL_PREPROCESSOR_ARGS Used to override the flags passed to the preprocessor that TAO_IDL uses. This can be used to alter the default options for the preprocessor and specify things like include directories and how the preprocessor is invoked. Two flags that will always be passed to the preprocessor are -DIDL and -I..
TAO_ROOT Used to determine where orb.idl is located.
ACE_ROOT Used to determine where orb.idl is located.
CIAO_ROOT Used to determine where Components.idl is located.

Because TAO_IDL doesn't have any code to implement a preprocessor, it has to use an external one. For convenience, it uses a built-in name for an external preprocessor to call. During compilation, this is how that default is set:

  1. If the macro TAO_IDL_PREPROCESSOR is defined, then it will use that.
  2. Else if the macro ACE_CC_PREPROCESSOR is defined, then it will use that.
  3. Otherwise, it will use "cc"

And the same behavior occurs for the TAO_IDL_PREPROCESSOR_ARGS and ACE_CC_PREPROCESSOR_ARGS macros.

Case 1 is used by the Makefile on most machines to specify the preprocessor. Case 2 is used on Windows and platforms that need special arguments passed to the preprocessor (MVS, HPUX, etc.). And case 3 isn't used at all, but is included as a default case.

Since the default preprocessor may not always work when TAO_IDL is moved to another machine or used in cross-compilation, it can be overriden at runtime by setting the environment variables TAO_IDL_PREPROCESSOR and TAO_IDL_PREPROCESSOR_ARGS.

In previous versions, the environment variables CPP_LOCATION and TAO_IDL_DEFAULT_CPP_FLAGS were used for this purpose. Both will still work, but TAO_IDL will display a deprecation warning if it detects one of these. It is possible that support for these old variables will be removed in a future version of TAO.

If ACE_ROOT or TAO_ROOT are defined, then TAO_IDL will use them to include the $(ACE_ROOT)/TAO/tao or $(TAO_ROOT)/tao directories. This is to allow TAO_IDL to automatically find <orb.idl> when it is included in an IDL file. TAO_IDL will display a warning message when neither is defined.


Operation Demuxing Strategies

The server skeleton can use different demuxing strategies to match the incoming operation with the correct operation at the servant. TAO's IDL compiler supports perfect hashing, binary search, and dynamic hashing demuxing strategies. By default, TAO's IDL compiler tries to generate perfect hash functions, which is generally the most efficient and predictable operation demuxing technique. To generate perfect hash functions, TAO's IDL compiler uses gperf , which is a general-purpose perfect hash function generator.

To configure TAO's IDL compiler to support perfect hashing please do the following:

Note that if you can't use perfect hashing for some reason the next best operation demuxing strategy is binary search, which can be configured using TAO's IDL compiler options.


AMI support

The TAO_IDL compiler generates AMI stubs and skeletons as described in the CORBA 3.0.3 specification.

Collocation Strategies

TAO_IDL can generate collocated stubs using two different collocation strategies. It also allows you to supress/enable the generation of the stubs of a particular strategy. To gain great flexibility at run-time, you can gereate stubs for both collocation strategies (using both '-Gp' and '-Gd' flags at the same time) and defer the determination of collocation strategy until run-time. On the other hand, if you want to minimize the footprint of your program, you might want to pre-determine the collocation strategy you want and only generate the right collocated stubs (or not generating any at all using both '-Sp' and '-Sd' flags at the same time if it's a pure client.) See our collocation paper for a detail discussion on the collocation support in TAO.


TAO's IDL Compiler Options

TAO's IDL compiler invokes your C (or C++) preprocessor to resolve included IDL files. It receives the common options for preprocessors (such as -D or -I). It also receives other options that are specific to it.

Option Description Remark
-u The compiler prints out the options that are given below and exits clean  
-V The compiler printouts its version and exits  
-Wb,option_list Pass options to the TAO IDL compiler backend.  
skel_export_macro=macro_name The compiler will emit macro_name right after each class or extern keyword in the generated skeleton header (*S.h) files. If CIAO servant code is being generated (see -Gsv option below), and svnt_export_macro (see below) isn't set, this macro will also appear in the generated CIAO servant (*_svnt.h) files, since skeleton and CIAO servant files are often compiled together. This macro is needed for Windows and newer versions of gcc, which require special directives to export symbols from DLLs, otherwise the definition is just a space. 
skel_export_include=include_path The compiler will generate code to include include_path at the top of the generated server header, this is usually a good place to define the server side export macro.
stub_export_macro=macro_name The compiler will emit macro_name right after each class or extern keyword in the generated stub code, this is needed for Windows and newer versions of gcc, which require special directives to export symbols from DLLs, otherwise the definition is just a space. 
stub_export_include=include_path The compiler will generate code to include include_path at the top of the client header, this is usually a good place to define the export macro.
anyop_export_macro=macro_name The compiler will emit macro_name before each Any operator or extern typecode declaration in the generated stub code, this is needed for Windows and newer versions of gcc, which require special directives to export symbols from DLLs, otherwise the definition is just a space on unix platforms. This option works only in conjuction with the -GA option, which generates Any operators and typecodes into a separate set of files. 
anyop_export_include=include_path The compiler will generate code to include include_path at the top of the anyop file header, this is usually a good place to define the export macro. This option works in conjuction with the -GA option, which generates Any operators and typecodes into a separate set of files.
svnt_export_macro=macro_name The compiler will emit macro_name right after each class or extern keyword in the generated CIAO servant code, if such code is being generated (see -Gsv option below). Since skeleton and servant files are often compiled together, the value of skel_export_macro will appear here, if it is set and svnt_export_macro is not. These macros are needed for Windows and newer versions of gcc, which require special directives to export symbols from DLLs - otherwise the definition is just a space. 
svnt_export_macro=include_path The compiler will generate code to include include_path at the top of the CIAO servant file header, if this file is being generated (see -Gsv option below). This is usually a good place to define the export macro.
exec_export_macro=macro_name The compiler will emit macro_name right after each class or extern keyword in the generated CIAO executor implmentation header (*_exec.h) files, if such code is being generated (see -Gex option below). These macros are needed for Windows and newer versions of gcc, which require special directives to export symbols from DLLs - otherwise the definition is just a space. 
exec_export_include=include_path The compiler will generate code to include include_path at the top of the CIAO executor implementation header (*_exec.h) file, if this file is being generated (see -Gex option below). This is usually a good place to define the export macro.
conn_export_macro=macro_name The compiler will emit macro_name right after each class or extern keyword in the generated CIAO connector implmentation header (*_conn.h) files, if such code is being generated (see -Gcn option below). These macros are needed for Windows and newer versions of gcc, which require special directives to export symbols from DLLs - otherwise the definition is just a space. 
conn_export_include=include_path The compiler will generate code to include include_path at the top of the CIAO connector implementation header (*_conn.h) file, if this file is being generated (see -Gcn option below). This is usually a good place to define the export macro.
export_macro=macro_name This option has the same effect as issuing
-Wb,skel_export_macro=macro_name
-Wb,stub_export_macro=macro_name
-Wb,anyop_export_macro=macro_name.
-Wb,svnt_export_macro=macro_name
-Wb,exec_export_macro=macro_name
-Wb,conn_export_macro=macro_name
This option is useful when building a single DLL or when some code generation is suppressed or not triggered (see option -SS below).
export_include=include_path This option has the same effect as specifying
-Wb,stub_export_include=include_path
-Wb,skel_export_include=include_path
-Wb,anyop_export_include=include_path.
-Wb,svnt_export_include=include_path
-Wb,exec_export_include=include_path
-Wb,conn_export_include=include_path
This option goes with the previous option to build a DLL containing all code generation, or when some code generation is suppressed (see option -SS below).
pch_include=include_path The compiler will generate code to include include_path at the top of all TAO IDL compiler generated files. This can be used with a precompiled header mechanism, such as those provided by Borland C++Builder or MSVC++.
obv_opt_accessor The IDL compiler will generate code to optimize access to base class data for valuetypes.
pre_include=include_path The compiler will generate code to include include_path at the top of the each header file, before any other include statements. For example, ace/pre.h, which pushes compiler options for the Borland C++ Builder and MSVC++ compilers, is included in this manner in all IDL-generated files in the TAO libraries and CORBA services.
post_include=include_path The compiler will generate code to include include_path at the bottom of the each header file. For example, ace/post.h, which pops compiler options for the Borland C++ Builder and MSVC++ compilers, is included in this manner in all IDL-generated files in the TAO libraries and CORBA services.
include_guard=define The compiler will generate code the define in the C.h file to prevent users from including the generated C.h file. Useful for regenerating the pidl files in the archive.
safe_include=file File that the user should include instead of this generated C.h file. Useful for regenerating the pidl files in the archive.
unique_include=file File that the user should include instead of the normal includes in the C.h file. Useful for regenerating the *_include pidl files in the archive.
-E Invoke only the preprocessor  
-Wp,option_list Pass options to the preprocessor.  
-d Causes output of a dump of the AST  
-Dmacro_definition It is passed to the preprocessor  
-Umacro_name It is passed to the preprocessor  
-Iinclude_path It is passed to the preprocessor  
-Aassertion It is passed to the preprocessor  
-Yp,path Specifies the path for the C preprocessor  
-H perfect_hash To specify the IDL compiler to generate skeleton code that uses perfect hashed operation demuxing strategy, which is the default strategy. Perfect hashing uses gperf program, to generate demuxing methods.   
-H dynamic_hash To specify the IDL compiler to generate skeleton code that uses dynamic hashed operation demuxing strategy.   
-H binary_search To specify the IDL compiler to generate skeleton code that uses binary search based operation demuxing strategy.   
-H linear_search To specify the IDL compiler to generate skeleton code that uses linear search based operation demuxing strategy. Note that this option is for testing purposes only and should not be used for production code since it's inefficient.  
-in To generate #include statements with <>'s for the standard include files (e.g. tao/corba.h) indicating them as non-changing files  
-ic To generate #include statements with ""s for changing standard include files (e.g. tao/corba.h).  
-g path To specify the path for the perfect hasing program (GPERF). Default is $ACE_ROOT/bin/ace_gperf.   
-o path To specify the output directory to IDL compiler as to where all the IDL-compiler-generated files are to be put. By default, all the files are put in the current directory from where is called.  If the specified directory does not exist, it will be created, if any path that may precede the directory name already exists. If the directory itself already exists, no action is taken. 
-oS path Same as -o option but applies only to generated *S.* files  Default is value of -o option or current directory 
-oA path Same as -o option but applies only to generated *A.* files  Default is value of -o option or current directory 
-hc Client's header file name ending. Default is "C.h".  
-hs Server's header file name ending. Default is "S.h".  
-hT Server's template header file name ending. Default is "S_T.h".  
-cs Client stub's file name ending. Default is "C.cpp".  
-ci Client inline file name ending. Default is "C.inl".  
-ss Server skeleton file name ending. Default is "S.cpp".  
-sT Server template skeleton file name ending. Default is "S_T.cpp".  
-si Server inline skeleton file name ending. Default is "S.inl".  
-t Temporary directory to be used by the IDL compiler. Unix: use environment variable TEMPDIR if defined, else use /tmp/. Windows NT/2000/XP: use environment variable TMP or TEMP if defined, else use the Windows directory.
-Cw Output a warning if two identifiers in the same scope differ in spelling only by case (default is output of error message). This option has been added as a nicety for dealing with legacy IDL files, written when the CORBA rules for name resolution were not as stringent.
-Ce Output an error if two indentifiers in the same scope differ in spelling only by case (default).  
-ae Output an error if an anonymous type is seen. Anonymous types are deprecated by the OMG spec (default is no output). This behavior can be selected globally by defining IDL_ANON_ERROR in config.h. It may then be overridden locally by -aw or -as
-aw Output a warning if an anonymous type is seen. Anonymous types are deprecated by the OMG spec (default is no output). This behavior can be selected globally by defining IDL_ANON_WARNING in config.h. It may then be overridden locally by -ae or -as
-as Silence any diagnostic output for anonymous types (default). This behavior can be selected globally by defining IDL_ANON_SILENT in config.h. It may then be overridden locally by -aw or -ae
-GC Generate AMI stubs ("sendc_" methods, reply handler stubs, etc)  
-GH Generate AMH stubs, skeletons, exception holders, etc.  
-GM Generate AMI4CCM code *A.idl file (containing callback interface, "sendc_" methods and CCM connector) plus addition to CCM servant and exectuor
-Gp Generated collocated stubs that use Thru_POA collocation strategy (default)  
-Gd Generated collocated stubs that use Direct collocation strategy  
-Gce Generated code for CORBA/e. This reduces the size of the generated code  
-Gmc Generated code for Minimum CORBA. This reduces the size of the generated code  
-Gcl Generated code for LwCCM. This reduces the size of the generated code  
-Gsp Generate client smart proxies  
-Gt Generate optimized TypeCodes  
-GX Generate empty A.h file Used by TAO developers for generating an empty A.h file when the -GA option can't be used. Overrides -Sa and -St.
-Guc Generate uninlined constant if defined in a module Inlined (assigned a value in the C++ header file) by default, but this causes a problem with some compilers when using pre-compiled headers. Constants declared at global scope are always generated inline, while those declared in an interface or a valuetype never are - neither case is affected by this option.
-Gse Generate explicit export of sequence's template base class Occasionally needed as a workaround for a bug in Visual Studio (.NET 2002, .NET 2003 and Express 2005) where the template instantiation used for the base class isn't automatically exported
-GI Generate boiler-plate files that contain empty servant implementations  
-GIh arg Servant implementation header file name ending  
-GIs arg Servant implementation skeleton file name ending  
-GIb arg Prefix to the implementation class names  
-GIe arg Suffix to the implementation class names  
-GIc Generate copy constructors in the servant implementation template files  
-GIa Generate assignment operators in the servant implementation template files  
-GId Generate IDL compiler source file/line# debug info in implementation files  
-GT Enable generation of the TIE classes, and the *S_T.* files that contain them.  
-GA Generate type codes and Any operators in *A.h and *A.cpp Decouples client and server decisions to compile and link TypeCode- and Any-related code, which is generated in *C.h and *C.cpp by default. If -Sa or -St also appear, then an empty *A.h file is generated.
-Gos Generate std::ostream insertion operators for IDL declarations ORB IDL declarations (including the basic type sequences) don't have these operators generated by default, to avoid the increased footprint. To turn on this generation for ORB IDL files, set gen_ostream=1 in your default.features MPC file. If this option is used on application IDL that references any of the predefined basic sequence IDL types, TAO must be compiled with the gen_ostream feature turned on.
-Gsv Generate CIAO servant code for component and home IDL declarations Replaces code generation formerly done by the CIAO CIDL compiler.
-Gex Generate CIAO executor implementation code for component and home IDL declarations Replaces code generation formerly done by the CIAO CIDL compiler. This code generation was optional, and triggered by the CIDLcompiler option --gen-exec-impl. These files have empty function bodies for all facet, suported and inherited operations, to be filled in by the developer.
-Gcn Generate CIAO connector implementation code for connector IDL declarations Generate a complete implementation for each connector. Specialized at present for DDS connectors.
-Glem Generate CIAO executor IDL for component and home IDL declarations Replaces code generation formerly done by the CIAO CIDL compiler.
-Glfa Generate CIAO facet servant IDL and C++ for all interfaces Replaces the CIDL compiler option --lem-force-all. This option causes facet executor IDL and a facet servant C++ class to be gnerated for each interface in the translation unit (default behavior is to navigate to such interfaces from component provides declarations). This option allows facet servant code to be shared among components that use the same interface as a facet. Care must be taken by the user to apply this option consistently to all builds where this behavior is desired.
-Gsw Generate CIAO servant code to support component swapping Modify the generated servant code and container file includes to support on-the-fly swapping of components.
-Gxhst Generate the stub export header file This is the file specified in -Wb,stub_export_include=include_path
-Gxhsk Generate the skeleton export header file This is the file specified in -Wb,skel_export_include=include_path
-Gxhsv Generate the CIAO servant export header file This is the file specified in -Wb,svnt_export_include=include_path
-Gxhex Generate the executor export header file This is the file specified in -Wb,exec_export_include=include_path
-Gxhcn Generate the connector export header file This is the file specified in -Wb,conn_export_include=include_path
-Sa Suppress generation of the Any operators  
-Sal Suppress generation of the Any operators for local interfaces only  
-Sp Suppress generation of collocated stubs that use Thru_POA collocation strategy  
-Sd Suppress generation of collocated stubs that use Direct collocation strategy (default)  
-St Suppress generation of typecodes Also suppresses the generation of the Any operators, since they need the associated typecode.
-Sm Suppress C++ code generation from CCM 'implied' IDL. This code generation is achieved by default using a 'preprocessing' visitor that modified the AST and is launched just before the code generating visitors. There is a new tool in CIAO that converts the entire IDL file into one containing explicit declarations of the implied IDL types. For such a file, we don't want the preprocessing visitor to be launched, so this command line option will suppress it.
-SS Suppress generation of the skeleton implementation and inline file. This option doesn't check whether something is generated in the files. It just suppresses them without looking at any possible contents;
-Sci Suppress generation of the client inline file. This option doesn't check whether something is generated in the file. It just suppresses it without looking at any possible contents;
-Scc Suppress generation of the client stub file. This option doesn't check whether something is generated in the file. It just suppresses it without looking at any possible contents;
-Ssi Suppress generation of the server inline file. This option doesn't check whether something is generated in the file. It just suppresses it without looking at any possible contents;
-Ssc Suppress generation of the server skeleton file. This option doesn't check whether something is generated in the file. It just suppresses it without looking at any possible contents;
-Sorb Suppress generation of the ORB.h include. This option is useful when regenerating pidl files in the core TAO libs to prevent cyclic includes;
-Se Disable custom header file name endings for files that are found in TAO specific include directories (i.e. $TAO_ROOT, $TAO_ROOT/tao, $TAO_ROOT/orbsvcs, $TAO_ROOT/CIAO, $TAO_ROOT/CIAO/ciao, $TAO_ROOT/CIAO/ccm). This option is useful when used together with -hs or -hc. I.e. when user needs custom file name endings for his/her own files but still wants to use TAO specific files with their original endings;
-Sg Disable generation of unique preprocessor guards for generated header files. The guards will still be generated, but without the unique random extension. This option is useful when a system has several versions of a generated header file, and only the newest version is to be included by the preprocessor. The default behavior will generate a unique extension for each version, subverting the desired function of the preprocessor in such a system.
-Sfr Disable CIAO servant code generation to register valuetype factories for events. By default, the generated CIAO servant constructor will register a valuetype factory with the container ORB for each eventtype used in an event source or sink port. However, if an eventtype has a factory function or other operation, the generated valuetype factory class will be abstract and must be overridden by the user, and registered in hand-written code.
-TS value Set tab size for generated files Default is 2 spaces


Back to the TAO documentation.