PreviousNext

Import Declarations

The IDL import declaration specifies another interface definition whose types and constants are used by the importing interface. (Similar to the include declaration in C.)

The import declaration allows you to collect declarations for types and constants that are used by several interfaces into one common file. For example, if you are defining two database interfaces named dblookup and dbupdate, and these interfaces have many data types and constants in common, you can declare those data types and constants in a dbcommon.idl file and import this file in the dblookup.idl and dbupdate.idl interface definitions. For example:

import "dbcommon.idl";

By default, the IDL compiler resolves relative path names of imported files by looking first in the current working directory and then in the system IDL directory. The -I option of the IDL compiler allows you to specify additional directories to search. You can thereby avoid putting absolute path names in your interface definitions. For example, if an imported file has the absolute path name /dbproject/src/dbconstants.idl, then the IDL compiler option -I/dbproject/src allows you to import the file by its leaf name, dbconstants.idl.