import

import "filename" [[ , ... ]] ;

filename
Specifies the name of the header, IDL, or ODL file to import.

Examples

import "myoldodl.odl";   
import "unknwn.idl";
import "part1.idl", "part2.idl", "part3.idl";   
 

Remarks

The import directive specifies another IDL, ODL or header file containing definitions you wish to reference from your main IDL file. All IDL statements in the imported file, such as typedefs, constant declarations, and interface definitions become available to the importing .IDL file.

The imported file is processed separately (meaning that CPP preprocessor is invoked independently) from the importing IDL file. In this way, pre-processor directives, such as #define, do not carry over from an imported header or IDL file to the importing IDL file.

Like the C-language preprocessor macro #include, the import directive tells the compiler to include data types that were defined in the imported IDL files. Unlike the #include directive, the import directive ignores procedure prototypes, since no stubs are generated for anything in the imported file.

For specific information on using import to include header files in an IDL file, see Importing System Header Files.

The C-language header (.H) file generated for the interface does not directly contain the imported types but instead generates a #include directive for the header file corresponding to the imported interface. For example, when you import BASE.IDL into your DERIVED.IDL, the generated header file DERIVED.H will contain the directive #include BASE.H.

The following rules apply:

Note  The behavior of the import directive is independent of the MIDL compiler mode switches /ms_ext (the default), /osf, and /app_config. However, the compiler mode (/osf vs. /ms_ext) can affect pointer attribute decoration on imported types. For details see Pointer-Attribute Type Inheritance.

See Also

IDL, importlib, include, Importing System Header Files, Importing Files and Type Libraries, /ms_ext, /osf