Next: Structure-Packing Pragmas, Previous: Solaris Pragmas, Up: Pragmas
For compatibility with the Solaris and Tru64 UNIX system headers, GCC
supports two #pragma
directives which change the name used in
assembly for a given declaration. #pragma extern_prefix
is only
available on platforms whose system headers need it. To get this effect
on all platforms supported by GCC, use the asm labels extension (see Asm Labels).
redefine_extname
oldname newname__PRAGMA_REDEFINE_EXTNAME
will be defined if this pragma is available (currently on all platforms).
extern_prefix
stringextern_prefix
pragma
whose argument is an empty string. The preprocessor macro
__PRAGMA_EXTERN_PREFIX
will be defined if this pragma is
available (currently only on Tru64 UNIX).
These pragmas and the asm labels extension interact in a complicated manner. Here are some corner cases you may want to be aware of.
#pragma redefine_extname
is
always the C-language name.
#pragma extern_prefix
is in effect, and a declaration
occurs with an asm label attached, the prefix is silently ignored for
that declaration.
#pragma extern_prefix
and #pragma redefine_extname
apply to the same declaration, whichever triggered first wins, and a
warning issues if they contradict each other. (We would like to have
#pragma redefine_extname
always win, for consistency with asm
labels, but if #pragma extern_prefix
triggers first we have no
way of knowing that that happened.)