Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Tyler wrote:Person 1: Do you have a fish?
Person 2: Yes, there's a rabbit over there.
Might i inquire the reasoning of this remark? Lets try to keep on track. At one point in time you also would have learned about extern "C" before int main to compile C++ executables.
Woo how subtle sniffed in an answer in a friendly nudge.
Tyler wrote:Person 1: Do you have a fish?
Person 2: Yes, there's a rabbit over there.
Might i inquire the reasoning of this remark? Lets try to keep on track. At one point in time you also would have learned about extern "C" before int main to compile C++ executables.
Woo how subtle sniffed in an answer in a friendly nudge.
Well i was going to say objdump, but Brynet got in there and posted another method of actually checking the symbol name, so i just threw that in as a little joke post thinking that the topic would end there... apparenly not as funny as it sounded in my head...
Kudos on the answer in the form of a nostalgic statement!
I had trouble with this too, and I fixed it by calling "main" not "_main" from the ASM file, and changing the extern statement to "main" from "_main"...maybe you could try that...
piranha wrote:I had trouble with this too, and I fixed it by calling "main" not "_main" from the ASM file, and changing the extern statement to "main" from "_main"...maybe you could try that...
-JL
The question has been answered already... C++ mangles identifiers. extern "C" will fix it.
I don't think g++ mangles the name of the main function (as long as it is a traditional int main()) by default - I've followed the cross-compiler tutorials and that certainly leaves you with a compiler that produces the symbol 'main' whether or not you use extern "C".
The leading underscore has nothing to do with C++ name-mangling. It is possible to use the -fleading-underscore / -fno-leading-underscore option with gcc and g++ (iirc there is also a configure switch for that, look for yourself), look into the gcc manuals.
bluecode wrote:The leading underscore has nothing to do with C++ name-mangling. It is possible to use the -fleading-underscore / -fno-leading-underscore option with gcc and g++ (iirc there is also a configure switch for that, look for yourself), look into the gcc manuals.