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.
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>,>...
#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 "/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.
-map2package CosTransactions org.omg
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>]*