/* When you make a function called main() in a GCC program, it wants
this stuff too. */
void _main() { }
That comment is a lie, isn't it?
Name:
Anonymous2008-07-16 20:08
They are confused about what happens once it is compiled. Your function named "main" gets converted internally to a symbol called "_main". Compile "int main() { return 0; }" using gcc and then run nm on it to verify.
Name:
Anonymous2008-07-16 20:29
>>2
That's what I figured.
Although upon testing this myself I find out that my version of gcc (4.2.3 on Slackware) doesn't seem to do this. It's just "main".
Name:
Anonymous2008-07-16 21:19
Indeed, on my *n?x boxen with gcc 4.2.4, main is not converted because it generates a symbols _init and _start which eventually calls main.
My Mac has gcc 4.0.1 and it generates the _main function with no _start or _init. Perhaps this person is a macfag... I still don't get why they think you have to explicitly define it?
Name:
Anonymous2008-07-17 2:08
In C, function names are decorated by putting the underscore in front of the name. In C++, they are decorated by randomly mashing the keyboard. Your nm binaries are configured to demangle the symbols by default, use the --no-demangle switch to see the true names.
Name:
Anonymous2008-07-17 3:55
THEMOREYOUKNOW
Name:
Anonymous2008-07-17 4:14
DID YOU KNOW
...that Apple's perl in 10.5 is built with -O3?
Name:
Anonymous2008-07-17 5:16
DID YOU KNOW
...that Apple's mod_perl in 10.5 can't load XS modules?