Keil Logo

alias("target")

Specify multiple aliases for variables and functions using this attribute.

Where a variable or function is defined in the current translation unit, the alias reference is replaced by a reference to the variable or function, and the alias is emitted alongside the original name.

Where a variable or function is not defined in the current translation unit, the alias reference is replaced by a reference to the real variable or function.

Where a variable or function is defined as static, the variable or function name is replaced by the alias name and the variable or function is declared external if the alias is declared external.

Example

#include <stdio.h>
int oldname = 1;
extern int newname __attribute__((alias("oldname")));    // declaration

void foo(void)  {
  printf("newname = %d\n", newname);                     // prints 1
}

Example

#include <stdio.h>

void foo(void)  {
  printf("%s\n", __FUNCTION__);
}

void bar(void) __attribute__((alias("foo")));

void gazonk(void)  {
  bar();                                                 // calls foo
}

See also:

  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.