Erlang -- Using the IC Compiler

User's Guide
Reference Manual
Release Notes
PDF
Top

ic
User's Guide
Version 4.2.27

Expand All
Contract All

Chapters

- Using the IC Compiler
  - Top of chapter
  - Introduction
  - Compilation of IDL Files
- OMG IDL
  - Top of chapter
  - OMG IDL - Overview
- IC Protocol
  - Top of chapter
  - Introduction
  - Language mappings and IDL operations
  - IC Protocol
  - Gen_server Protocol
  - Erlang Distribution Protocol
- Using the Plain Erlang Back-end
  - Top of chapter
  - Introduction
  - Compiling the Code
  - Writing the Implementation File
  - An Example
- Using the Erlang Generic Server Back-end
  - Top of chapter
  - Introduction
  - Compiling the Code
  - Writing the Implementation File
  - An Example
- IDL to C mapping
  - Top of chapter
  - Introduction
  - C Mapping Characteristics
  - Basic OMG IDL Types
  - Constructed OMG IDL Types
  - OMG IDL Constants
  - OMG IDL Operations
  - Exceptions
  - Access to Attributes
  - Summary of Argument/Result Passing for the C-client
  - Supported Memory Allocation Functions
  - Special Memory Deallocation Functions
  - Exception Access Functions
  - Special Types
  - A Mapping Example
- The C Client Back-end
  - Top of chapter
  - Introduction
  - Generated Stub Files
  - C Interface Functions
  - Generating, Compiling and Linking
  - An Example
- The C Server Back-end
  - Top of chapter
  - Introduction
  - Generated Stub Files
  - C Skeleton Functions
  - The Server Loop
  - Generating, Compiling and Linking
  - An Example
- CORBA_Environment C Structure
  - Top of chapter
  - C Structure
  - The CORBA Compatibility Part
  - The External Part
  - The Internal Part
  - Creating and Initiating the CORBA_Environment Structure
  - Setting System Exceptions
- IDL to Java language Mapping
  - Top of chapter
  - Introduction
  - Specialties in the Mapping
  - Basic OMG IDL Types
  - Constructed OMG IDL Types
  - Mapping for Constants
  - Invocations of Operations
  - Exceptions
  - Access to Attributes
  - Summary of Argument/Result Passing for Java
  - Communication Toolbox
  - The Package com.ericsson.otp.ic
  - The Term Class
  - Stub File Types
  - Client Stub Initialization, Methods Exported
  - Server Skeleton Initialization, Server Stub Implementation, Methods Exported
  - A Mapping Example
  - Running the Compiled Code

# 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 behavior 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.

Back-end | BackEndoption
IDL to CORBA | erl_corba
IDL to CORBA template | erl_template
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

Table 1.1: Compiler back-ends and options

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