RE: [AD] Proposal for new magic main

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


Title: RE: [AD] Proposal for new magic main

> For 4.1.x, yes, because argc/argv is not portable (you
> absolutely need a
> WinMain() under Windows).

Huh ?
I thought the main thing was ANSI C ??
Well, fair enough then. Though in this case I'd say the *Windows*
way is not portable, not the other way round.
Besides, I don't think Windows looks for a WinMain symbol at load
time, that would be even more ridiculous, so there's chance it's
only the linker that defaults to a WinMain called entry point. In
this case, the Allegro link command could just set this entry point
to a sane value (eg, main). So people would not have to bother
about this lunatic WinMain thing.
Just checked, link.exe has a /ENTRY:symbol option which appears
to do just that.
Hmm, this leaves the fact that the wrong arguments will be passed
to the entry point. This could be addressed by a macro to generate
argc/argv, which would just use argc/argv except on Win32, where
it would slice up the command line (I see one Win32 program here,
taking a LPSTR (a disguised char*, I think) to a command line,
as third parameter which could be strtok'd). Yes, this would have
to use cpp and not be very pretty, but at least it wouldn't be at
the external symbol level.
This would require a change in the link command though, to include
this /ENTRY:main option. Is there such a thing as allegro-config
on Win32, or is this a Unix only thing ?

--
Vincent Penquerc'h



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