Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.

export

Causes a data structure to be placed in the .idl file.

[export]

The export C++ attribute causes a data structure to be placed in the .idl file and to then be available in the type library in a binary-compatible format that makes it available for use with any language.

You cannot apply the export attribute to a class even if the class only has public members (the equivalent of a struct).

If you export unnamed enums or structs, they will be given names that begin with __unnamedx, where x is a sequential number.

The typedefs valid for export are base types, structs, unions, enums, or type identifiers. See typedef for more information.

The following code shows how to use the export attribute:

// cpp_attr_ref_export.cpp
// compile with: /LD
[module(name="MyLibrary")];

[export]
struct MyStruct {
   int i;
};

Attribute Context

Applies to

union, typedef, enum, struct, or interface

Repeatable

No

Required attributes

None

Invalid attributes

None

For more information, see Attribute Contexts.

Community Additions

ADD
Show:
© 2015 Microsoft