int main (void) __attribute__ ((weak, alias ("alt_main")));
怎样理解?
weak
weak
attribute causes the declaration to be emitted as a weak symbol rather than a global. This is primarily useful in defining library functions which can be overridden in user code, though it can also be used with non-function declarations. Weak symbols are supported for ELF targets, and also for a.out targets when using the GNU assembler and linker.
alias ("
target")
alias
attribute causes the declaration to be emitted as an alias for another symbol, which must be specified. For instance, void __f () { /* Do something. */; }
void f () __attribute__ ((weak, alias ("__f")));
declares f
to be a weak alias for __f
. In C++, the mangled name for the target must be used.
Not all target machines support this attribute.
用户786838 2007-9-28 23:16
用户31660 2006-9-23 22:50
用户39711 2006-9-22 15:52
用户37655 2006-9-19 11:40