| |||
| Home > Directives Reference > Miscellaneous directives > EXPORT or GLOBAL | |||
The EXPORT directive declares a symbol that can
be used by the linker to resolve symbol references in separate object
and library files. GLOBAL is a synonym for EXPORT.
EXPORT{symbol}{[WEAK,attr]}
where:
symbolis the symbol name to export. The symbol name is
case-sensitive. If is
omitted, all symbols are exported.symbol
[WEAK]means that this instance of should
only be imported into other sources if no other source exports an
alternative instance. If symbol[WEAK] is used without ,
all exported symbols are weak.symbol
[attr]is symbol visibility when linked into a dynamic component. By default, symbol binding defines visibility, that is, global and weak symbols are visible to other components and local symbols are not hidden.
Valid attributes are:
DYNAMIC is
visible to other components, and can be redefined by other components.symbol
HIDDEN cannot
be referenced outside the component where it is defined, either
directly or indirectly.symbol
The linker also accepts INTERNAL and
currently treats it as HIDDEN. If you specify
both, for example:
EXPORT SymA[WEAK,INTERNAL,HIDDEN]
the assembler chooses the most restrictive (INTERNAL).
PROTECTED is
visible to other components, and cannot be redefined by other components.symbol
Use EXPORT to give code in other files access
to symbols in the current file.
Use the [WEAK] attribute to inform the linker
that a different instance of takes precedence
over this one, if a different one is available from another source.
You can use the symbol[WEAK] attribute with any of the symbol
visibility attributes.
Symbol visibility can be overridden for duplicate exports.
In the following example, the last EXPORT takes precedence
for both binding and visibility:
EXPORT SymA[WEAK] ; Export as weak-hidden
EXPORT SymA[DYNAMIC] ; SymA becomes non-weak dynamic.
See also IMPORT.