Tutorial of gcc __attribute__ ((alias))

GCC Attribute alias allows you to specify multiple aliases(other names) for a symbol (function/variable).

Example of aliasing a function name:

Code:




Output:

myfunc: Adding 3 with 6: Result:9

myfunc: Adding 3 with 5: Result:8

Notes:

You can see, calling add, the compiler will only call myfunc. Also point to be noted is __func__ returns myfunc on call to add.

Example of aliasing a variable:

Code:



Output:

Value of new name is :5

Comments

Popular posts from this blog

bb.utils.contains yocto

Difference between RDEPENDS and DEPENDS in Yocto

PR, PN and PV Variable in Yocto