The alias function attribute causes the function declaration to
appear in the object file as an alias for another symbol. This language
feature provides a technique for coping with duplicate or cumbersome
names.
The alias function attribute follows the general syntax for function attributes. The following diagram shows the supported forms.
>>-__attribute__------------------------------------------------> >--((--+-alias-----+--(--"original_function_name"--)--))------->< '-__alias__-'
The aliased function can be defined after the specification of its alias
with this function attribute. C also allows an alias specification in
the absence of a definition of the aliased function in the same compilation
unit.
The original_function_name must be the mangled name.
The following declares bar to be an alias for __foo:
void __foo(){ /* function body */ } void bar() __attribute__((alias("__foo")));
extern "C" __foo(){ /* function body */ } void bar() __attribute__((alias("__foo")));
The compiler does not check for consistency between the declaration of bar and definition of __foo. Such consistency remains the responsibility of the programmer.
Related References