Re: [AD] END_OF_MAIN, again

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On 8/10/05, Chris <chris.kcat@xxxxxxxxxx> wrote:
But the user won't be declaring _mangled_main as extern "C", so it'll still be
a regular C++ symbol.

But if you have extern "C" in declaration, and user make function with same signature (name + arguments) compiler will use C linking for it. 

And you'd need three, if not four, cppmain.cpp files.

int main()  C++ symbol
int main(int argc) Why would someone this, is it in standard ?
int main(int argc, char **argv); // C symbol (via extern "C")
int main(int argc, char **argv, char **argz); // Not supported by allegro's _WinMain

I had this idea:

alwin.h: define main = _mangled_main, install_allegro to use _force_main_linking, extern "C" _mangled_main(int, char **) C++ only
wmain.c: have WinMain call _mangled_main (C symbol)

This will cover C's main(void), main(int, char **) and C++'s main(int, char **). About C++'s main(void) it can be solved in two ways: C++ source with dummy _mangled_main or by forcing user to use main(int, char **) when programming in C++.


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/