A single .idl file can define multiple interfaces. This allows, for example, a class and its metaclass to be defined in the same file. When a file defines two (or more) interfaces that reference one another, forward declarations can be used to declare the name of an interface before it is defined. This is done as follows:
interface class-name ;
The actual definition of the interface for "class-name" must appear later in the same .idl file.
If multiple interfaces are defined in the same .idl file, and the classes are not a class-metaclass pair, they can be grouped into modules, by using the following syntax:
module module-name { definition+ };
where each "definition" is a type declaration, constant declaration, exception declaration, interface statement, or nested module statement. Modules are used to scope identifiers (see below).
Alternatively, multiple interfaces can be defined in a single .idl file without using a module to group the interfaces. Whether or not a module is used for grouping multiple interfaces, the languages bindings produced from the .idl file will include support for all of the defined interfaces.
Note: When multiple interfaces are defined in a single .idl file and a module statement is not used for grouping these interfaces, it is necessary to use the functionprefix modifier to assure that different names exist for functions that provide different implementations for a method. In general, it is a good idea to always use the functionprefix modifier, but in this case it is essential.