import
Specifies another .idl, .odl, or header file containing definitions you want to reference from your main IDL.
[ import(
idl_file
) ];
idl_file
The name of an .idl file that you want imported into the type library of the current project.
The import C++ attribute causes an #import
statement to be placed below the import "docobj.idl"
statement in the generated .idl file. The import attribute has the same functionality as the import MIDL attribute.
The import attribute only places the specified file into the .idl file that will be generated by your project; the import attribute does not let you call constructs in the specified file from source code in your project. To call constructs in the specified file from source code in your project, either use #import and the embedded_idl
attribute or you can include the .h file for the idl_file, if a .h file exists.
The following code:
// cpp_attr_ref_import.cpp
// compile with: /LD
[module(name="MyLib")];
[import(import.idl)];
produces the following code in the generated .idl file:
import "docobj.idl";
import "import.idl";
[ uuid(EED3644C-8488-3ECD-BA97-147DB3CDB499), version(1.0) ]
library MyLib {
importlib("stdole2.tlb");
importlib("olepro32.dll");
...
Attribute context | Value |
---|---|
Applies to | Anywhere |
Repeatable | No |
Required attributes | None |
Invalid attributes | None |
For more information, see Attribute Contexts.
IDL Attributes
Stand-Alone Attributes
importidl
importlib
include
includelib