import
import
filename [ , ...
] ;
filename
Specifies the
name of the header or IDL file to import.
Examples
import "recycled.idl";
import "system.h";
import unknwn.idl ;
import "part1.idl", "part2.idl",
"part3.idl";
Remarks
The import
directive specifies another .IDL file containing definitions you wish to
reference from the main .IDL file. The imported file is processed separately
from the main IDL file and the CPP preprocessor is invoked independently on
this file. All resultant type, constant, and interface definitions are
available to the main .IDL file. This implies that CPP directives like #define
do not carry over from an imported IDL file to the main IDL file, and vice
versa
IDL
statements, such as const declarations, typedefs, and interfaces become
available to the importing file.
Similar to
the C-language preprocessor macro #include, the import directive
directs the compiler to include data types 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.
The import
keyword is optional and can appear zero or more times in the IDL file. Each import
keyword can be associated with more than one file name. Separate multiple
filenames with commas. You must enclose the file name within quotation marks
and end the import statement with a semicolon (;). Note that an interface
without attributes can be imported into a base IDL file. However, the interface
must contain only datatypes with no procedures. If even one procedure is
contained in the interface, a local
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
FOO.IDL imports BAR.IDL, the generated header file FOO.H includes BAR.H (FOO.H
contains the directive #include BAR.H).
The import
function is idempotent that is,
importing an interface more than once has no effect.
The behavior
of the import directive is independent of the MIDL compiler mode
switches /osf, and /app_config. However, pointer attribute
decoration across imports may depend on the compiler mode (/osv vs. the
default, /ms_ext). For details see Pointer-Attribute Type Inheritance
See Also