Using the IC Compiler

## 1 Using the IC Compiler

### 1.1 Introduction

The IC application is an IDL compiler implemented in Erlang. The IDL compiler generates client stubs and server skeletons. Several back-ends are supported, and they fall into three main groups.

The first group consists of a CORBA back-end:

IDL to Erlang CORBA
  This back-end is for CORBA communication and implementation, and the generated code uses the CORBA specific protocol for communication between clients and servers. See the Orber application User's Guide and manuals for further details.

The second group consists of a simple Erlang back-end:

IDL to plain Erlang
  This back-end provides a very simple Erlang client interface. It can only be used within an Erlang node, and the communication between client and "server" is therefore in terms of ordinary function calls.
  This back-end can be considered a short-circuit version of the IDL to Erlang gen_server back-end (see further below).

The third group consists of backends for Erlang, C, and Java. The communication between clients and servers is by the Erlang distribution protocol, facilitated by erl_interface and jinterface for C and Java, respectively.

All back-ends of the third group generate code compatible with the Erlang gen_server behaviour protocol. Thus generated client code corresponds to `call()` or `cast()` of an Erlang `gen_server`. Similarly, generated server code corresponds to `handle_call()` or `handle_cast()` of an Erlang `gen_server`.

The back-ends of the third group are:

IDL to Erlang gen_server
  Client stubs and server skeletons are generated. Data types are mapped according to the IDL to Erlang mapping described in the Orber User's Guide.
IDL to C client
  Client stubs are generated. The mapping of data types is described further on in the C client part of this guide.
IDL to C server
  Server skeletons are generated. The mapping of data types is described further on in the C server part of this guide.
IDL to Java
  Client stubs and server skeletons are generated. The mapping of data types is described further on in the Java part of this guide.

### 1.2 Compilation of IDL Files

The IC compiler is invoked by executing the generic `erlc` compiler from a shell:

    %> erlc +'{be,BackEnd}' File.idl

where `BackEnd` is according to the table below, and `File.idl` is the IDL file to be compiled.

Compiler back-ends and options
Back-end | `BackEnd` option
IDL to CORBA | `erl_corba`
IDL to plain Erlang | `erl_plain`
IDL to Erlang gen_server | `erl_genserv`
IDL to C client | `c_client`
IDL to C server | `c_server`
IDL to Java | `java`

For more details on IC compiler options consult the ic(3) manual page.

Copyright © 1991-2006 Ericsson AB