[Up: Implementation Overview]
[Previous: POA] [Next: Compiler and Linker Wrappers]

#
IDL Compiler

MICO offers its own IDL-compiler called `idl` which is briefly described in this section. The tool is used for translating IDL-specifications to C++ as well as feeding IDL-specifications into the interface repository. The `idl` tool takes its input either from a file or an interface repository and generates code for C++ or CORBA-IDL. If the input is taken from a file, the `idl` tool can additionally feed the specification into the interface repository. The synopsis for `idl` is as follows:

      idl [--help] [--version] [--config] [-D<define>] [-I<path>] \
          [--no-exceptions] [--codegen-c++] [--no-codegen-c++] \
          [--codegen-c++] [--no-codegen-c++] [--codegen-idl] \
          [--no-codegen-idl] [--codegen-midl] [--no-codegen-midl] \
          [--c++-suffix=<suffix>] [--c++-impl] \
          [--c++-skel] [--absolute-paths] \
          [--emit-repoids] [--do-not-query-server-for-narrow] [--feed-ir] \
          [--feed-included-defs] [--repo-id=<id>] [--name=<prefix>] \
          [--pseudo] [--any] [--typecode] \
          [--poa] [--no-poa] [--boa] [--no-boa] [--no-poa-ties] \
          [--gen-included-defs] [--gen-full-dispatcher] [<file>]

In the following a detailed description of all the options is given:

`-help`
  Gives an overview of all supported command line options.
`-version`
  Prints the version of MICO.
`-config`
  Prints some important configuration infos.
`-D<define>`
  Defines a preprocessor macro. This option is equivalent to the `-D` switch of most C-compilers.
`-I<path>`
  Defines a search path for `#include` directives. This option is equivalent to the `-I` switch of most C-compilers.
`-no-exceptions`
  Tells `idl` to disable exception handling in the generated code. Code for the exception classes is still generated but throwing exceptions will result in an error message and abort the program. This option can only be used in conjunction with `-codegen-c++`. This option is off by default.
`-codegen-c++`
  Tells `idl` to generate code for C++ as defined by the language mapping IDL to C++. The `idl` tool will generate two files, one ending in `.h` and one in `.cc` with the same basenames. This option is the default.
`-no-codegen-c++`
  Turns off the code generation for C++.
`-codegen-idl`
  Turns on the code generation for CORBA-IDL. The `idl` tool will generate a file which contains the IDL specification which can again be fed into the `idl` tool. The basename of the file is specified with the `-name` option.
`-no-codegen-idl`
  Turns off the code generation of CORBA-IDL. This option is the default.
`-c++-suffix=<suffix>`
  If `-codegen-c++` is selected, then this option determines the suffix for the C++ implementation file. The default is ```cc`''.
`-c++-impl`
  This option will cause the generation of some default C++ implementation classes for all interfaces contained in the IDL specification. This option requires `-codegen-c++`.
`-c++-skel`
  Generate a separate file with suffix `_skel.cc` that contains code only needed by servers (i.e., the skeletons). By default this code is emitted in the standard C++ implementation files. This option requires `-codegen-c++`.
`-hh-suffix=<suffix>`
  If `-codegen-c++` is selected, then this option determines the suffix for the C++ header file. The default is ```h`''.
`-relative-paths`
  If selected, included files (via the `#include` directive) will be referenced in a relative way (i.e. `#include ...`).
`-emit-repoids`
  This option will cause `#pragma` directives to be emitted, which associate the repository id of each IDL construct. This option can only be used in conjunction with the option `-codegen-idl`.
`-do-not-query-server-for-narrow`
  If this option is used, the IDL compiler will omit special code for all `_narrow()` methods which inhibits the querying of remote servers at runtime. In certain circumstances this is permissible, resulting in more efficient runtime behaviour. See `test/idl/26/README` for further comments.
`-feed-ir`
  The CORBA-IDL which is specified as a command line option is fed into the interface repository. This option requires the `ird` daemon to be running.
`-feed-included-defs`
  This option can only be used in conjunction with `-feed-ir`. If this option is used, IDL definitions located in included files are fed into the interface repository as well. The default is to feed only the definitions of the main IDL file into the IR.
`-repo-id=<id>`
  The code generation is done from the information contained in the interface repository instead from a file. This option requires the `ird` daemon to be running. The parameter `id` is a repository identifier and must denote a CORBA module.
`-name=<prefix>`
  This option controls the prefix of the file names if a code generation is selected. This option is mandatory if the input is taken from the interface repository. If the input is taken from a file, the prefix is derived from the basename of the file name.
`-pseudo`
  Generates code for ``pseudo interfaces''. No stubs, skeletons or code for marshalling data to and from ``any'' variables is produced. Only supported for C++ code generation.
`-any`
  Activates support for insertion and extraction operators of user defined IDL types for `Any`. Can only be used in conjunction with `-codegen-c++`. This option implies `-typecode`.
`-typecode`
  Generates code for TypeCodes of user defined IDL types. Can only be used in conjunction with `-codegen-c++`.
`-poa`
  Turns on generation of skeleton classes based on the Portable Object Adapter (POA). This is the default.
`-no-poa`
  Turns off generation of POA-based skeletons.
`-no-poa-ties`
  When using `-poa`, this option can be used to turn off generation of Tie classes if not needed.
`-boa`
  Turns on generation of skeleton classes using the Basic Object Adapter (BOA).
`-no-boa`
  Turns off generation of BOA-based skeletons. This is the default.
`-gen-included-defs`
  Generate code that was included using the `#include` directive.
`-gen-full-dispatcher`
  Usually the skeleton class generated for an interface contains only the dispatcher for the operations and attributes defined in this interface. With this option, the dispatcher will also include operations and attributes inherited from all base interfaces.

Here are some examples on how to use the `idl` tool:

`idl account.idl`
  Translates the IDL-specification contained in account.idl according to the C++ language mapping. This will generate two files in the current directory.
`idl -feed-ir account.idl`
  Same as above but the IDL-specification is also fed into the interface repository.
`idl -feed-ir -no-codegen-c++ account.idl`
  Same as above but the generation of C++ stubs and skeletons is omitted.
`idl -repo-id=IDL:Account:1.0 -no-codegen-c++ -codegen-idl -name=out`
  This command will generate IDL-code from the information contained in the interface repository. This requires the `ird` daemon to be running. The output is written to a file called `out.idl`.
`idl -no-codegen-c++ -codegen-idl -name=out account.idl`
  This command will translate the IDL-specification contained in `account.idl` and into a semantical equivalent IDL-specification in file `out.idl`. This could be useful if you want to misuse the IDL-compiler as a pretty printer.

[Previous: POA] [Next: Compiler and Linker Wrappers]
[Up: Implementation Overview]