NonStop Software

IDL Compiler Syntax

Previous Topic | Next Topic | Contents | Index
Getting Started Guide | Administration Guide | Programmer's Guide

Subtopics

Preliminary IDL Compiler Setup
NSDIDL Compiler Syntax
NSDIDL Compiler Options
NSDIDL Compiler Error Handling

Preliminary IDL Compiler Setup

The IDL compiler is written in the Java language, and the nsdidl.jar file contains all necessary compiler class files. Before you can run the IDL compiler, put nsdidl.jar into the CLASSPATH environment.

For example, on OSS use the following command:

export CLASSPATH=$CLASSPATH:FULLPATH/nsdidl.jar

Be sure to fully qualify the path of nsdidl.jar. Also make sure that nsdidl.jar cannot be extracted by using the jar tool. You can add the path to the .profile.

The IDL compiler uses cfe as the default preprocessor. Unless you will specify another preprocessor by using the compiler -preprocessor option, the cfe must be in the PATH environment. For example, on OSS, cfe resides in the /usr/lib directory, so you can run the following command on the command line or add it to the .profile:

export PATH=$PATH;/usr/lib

Note: If you change the .profile, be sure to source it in for the changes to take effect.


NSDIDL Compiler Syntax

Following is the command-line syntax for running the IDL compiler. You can also display help text onscreen by using the -? option.

nsdidl <options> <idlfile1>, <idlfile2,> ...

Where <options> are described in detail below.

For example, to invoke the compiler to generate C++ bindings, type the following command:

nsdidl -language C++ <idlfile1>, <idlfile2>,>...

NSDIDL Compiler Options

-client <suffix>
Specify the suffix for client-side header and generated language mapping files. This suffix is appended to the base IDL file name with an intervening underscore. The default is client.

-D <name>
Define <name> as a macro, with definition '1'. This is the same as if the -D <name>=1 option is used.

-D <name>=<definition>
Define <name> as a macro, with <definition> as the definition.

-generate <arg>
Generate C++ code corresponding to <arg>.
<arg> can be any of the following:

exceptions
Generate code using native C++ language exceptions.

namespace
Generate code using the C++ namespace feature.

tie
Generate code to enable the tie or delegation mechanism. Prefixing any arg with no- reverses the sense of the option.

-h <suffix>
Specify the suffix used for generated header files. By default, h is used for C++ language mapping.

-I <dir>
Insert the directory specified into the search path for #include files with names not beginning with a slash (/). -I <dir> is inserted ahead of the standard list of include directories. It may be specified more than once to add multiple directories to the search path.

-include <level>
The parameter <level> can be 0, 1, 2 .... The <level> specifies the number of directory paths in the generated include statements. So suppose a generated _client.h without the -include option has the following include:

#include "/h/bo/idltest/t1_client.h"

then, with -include 2 option, the include looks like:

include "idltest/t1_client.h"

and, with -include 1 option, the include looks like:

include "t1_client.h"

If <level> equals 0, the full path is generated. If <level> is more than the number of directories in the path, the full path is generated.

-ir
Generate an interface repository from the input IDL (the existing definitions in the interface repository are updated).

-IR
Generate an interface repository from the input IDL (the existing interface repository definitions are replaced).

-language <language>
Generate mapping for a specified language where the language is C++.

-map2package <moduleName> <packagePrefix>
(For Java only) Explicitly specifies the package in which an IDL module is located. For example: -map2package CosTransactions org.omg

-o <dir>
Place generated files in the specified output directory.

-s <suffix>
Specify the suffix used for generated language mapping files. By default, cpp is used for C++ language mapping.

-server <suffix>
Specify the suffix for the server-side header and generated language mapping files. This suffix is appended to the base IDL file name with an intervening underscore. The default is server.

-typecodes
Generate typecode constants for interfaces and types defined in the IDL file. When specified, the compiler generates any insertion or extraction operators for user-defined types (>>=, <<=).

-U
Remove any definition of <name> (overrides any -D in the command line no matter where it appears).

-<version>
Display the IDL compiler version number.

NSDIDL Compiler Error Handling

If you make an error while entering a compiler option, you will see the following message:

nsdidl: Error, unknown option: badargument,
use: nsdidl [-?][-D <name>][-D <name>=<definition>][-U][-I <dir>]
[-language (C++)][-version][-o <dir>]
[-generate <arg>][-h <suffix>][-s <suffix>]
[-client <suffix>][-server <suffix>][-include level]
[-typecodes][-IR][-ir][-preprocessor arg][-preprocessed] [<filename>]*

In the command line, you must place any options you are using after the command and before any file names. If an option appears after a file name, the following message appears:

nsdidl: Error, compiler options must precede file names,
use: nsdidl [-?][-D <name>][-D <name>=<definition>][-U][-I <dir>]
[-language (C++)][-version][-o <dir>]
[-generate <arg>][-h <suffix>][-s <suffix>]
[-client <suffix>][-server <suffix>][-include level]
[-typecodes][-IR][-ir][-preprocessor arg][-preprocessed] [<filename>]*

Previous Topic | Next Topic | Contents | Top
Getting Started Guide | Administration Guide | Programmer's Guide
Bibliography | Glossary | Index
© Tandem, a division of Compaq. All rights reserved. Legal notices.