C/C++ Programmer's Guide (G06.27+, H06.08+, J06.03+)

class-specific data (CGD). When given for specific members, only those members are exported
or imported. Within a single compilation unit, a class is not allowed to both export and import
members.
When you declare a class export$, all of its member functions, static data members, and
any CGDs are exported. Definitions for these member functions and static data members must
be provided. An error is issued for missing definitions. Exported member functions are never
inlined.
Selectively mark member functions and static data members as export$ or import$ only
if the entire class is marked as neither export$ nor import$. The compiler generates an
error if this rule is violated.
Selective member export/import is best used for providing a class interface that is more
restrictive, in which fewer members are exposed to the class’s clients.
If any member of a class is exported or imported, all of its CGDs are also exported or imported,
respectively.
Only members that are introduced by the class are exported or imported; methods inherited
by the class are not exported or imported.
Do not export a class definition in more than one compilation unit or load unit, and do not
mix explicit export$/import$ usage with default class definitions. That is, linking or loading
errors, or erroneous run-time type checking can occur if either one of these two paradigms is
not followed:
Exactly one compilation unit (and one load unit) explicitly exports the class (wholly or
selectively), and all others explicitly import it.
Every compilation unit defining the class uses a default definition (neither export$ nor
import$).
Examples of the Export Attribute (Native C++ Only)
// export everything from a class
class export$ C1 {
public:
int I; // class data, not exported
int foo (void) {returnI ;} // Exported member function
static int J; // Exported static data member
};
int C1::J = 1; // Definition for exported static data member
// import everything from a class
class import$ C2 {
public :
int I; // Class data, not imported
int foo (void) {return I;} // Imported member function,
// definition ignored
static int J; //Imported static data member
};
int C2::J = 1; // Error: definition for imported static data member
//selective exporting/importing
class C3a {
public :
52 C and C++ Extensions