DLL Programmer's Guide for TNS/R Systems

Essential DLL Facility Controls
DLL Programmer’s Guide for TNS/R Systems522203-002
2-12
Your Loadfile’s Exported Symbols
one item. When applied to the declaration of a class, it affects all the symbol
definitions within that class, including auxiliary compiler-generated definitions such as
type identification variables. This facility has several important advantages:
The identifiers can be marked in the source, avoiding the need to place details into
the linker's command stream.
The programmer need not know or enter the "mangled" form of C++ function
names to export them.
When marking a whole class, the programmer need not know its compiler-
generated auxiliary identifiers.
Not only can identifiers be marked exported in some linkfiles and loadfiles, they
can be marked imported in others. Judicious use of this ability can avoid unwanted
multiple definitions, reducing wasted address space and potential ambiguity.
(Linker commands can offer symbols for export, but cannot force them to be
imported.)
The export$ and import$ modifiers are not intended to be used explicitly, but instead to
occur within the expansions of defines. For example, consider the following header file
fragment:
#ifndef export_foo
# define export_foo import$
#endif
export_foo class foo {...}...
When this file is included in routine compilations, the various symbols associated with
this class definition will be marked as undefined, so they must be defined in another
linkfile or loadfile. However, the compilation of the module that implements class foo
can contain
#define export_foo export$
ahead of the #include directive for this header file. As a result, this compilation will
define all the symbols associated with class foo, and mark them offered for export.
Your Loadfile’s Exported Symbols
By default, the linker causes your loadfile to offer for export those symbols for which
your compiler sets the xport bit in the external symbol table. To know which these
are, you must know which symbols your compiler designates this way. To ensure that
your loadfile offers for export all needed symbols, insert the -export_all option.
This causes the loadfile to offer all symbols except:
Those used internally by the compiler and linker
Those used only in starting up or shutting down the loadfile