C/C++ Programmer's Guide (G06.25+)
C and C++ Extensions
HP C/C++ Programmer’s Guide for NonStop Systems—429301-008
2-4
Declarations
Export Attribute (Native C and C++ Only)
The export$ and import$ keywords are supported only on native C/C++. These
keywords export and import functions and data to and from a DLL, SRL, or PIC
program. They specify whether a defined or declared class is to be exported or
imported, respectively.
Usage Guidelines for Export Attribute
•
The keyword export$ may only be used with a definition. If specified for a
declaration, and its definition is not within the compilation unit, an error is
generated. If export$ is applied to a tentative definition, the compiler treats the
tentative definition as a real definition. In C, a tentative definition is a declaration of
an identifier of an object that has file scope without an initializer, and without the
storage class specifier extern.
•
The keyword import$ may only be used with a declaration. If specified for a
definition, an error is generated. If it is applied to a tentative definition, the compiler
treates the tentative definition as a declaration.
•
If a single module in a program has both an import$ and an export$ attribute
specified for the same function or object, the export$attribute takes precedence
over the import$ attribute. The compiler generates a warning.
•
These keywords cannot be applied to static functions, static data, or auto data. The
compiler issues an error for these assignments.
export-attribute:
export$
indicates that a specification is a definition and its associated members
will be exported.
import$
indicates that a specification is only a declaration and that the definition
will be found through external linkage to a library where the associated
members are exported. If applied to a definition, the definition will be
treated as a declaration.