Kevin O'Connor escreveu:
> On Thu, Nov 23, 2006 at 04:10:44AM +0000, Pedro Alves wrote:
>   
>> Kevin O'Connor escreveu:
>>     
>>> As to a fix - I'm a bit confused by the current mingw crt1.c code.
>>> Why do we have WinMainCRTStartup call main() which then calls WinMain.
>>> Wouldn't it be simpler to have a dummy WinMain that calls main().
>>> This way, the code doesn't have to scan all the command-line arguments
>>> if the application isn't interested in them.
>>>       
>
> Hi Pedro,
>
> If I understand you correctly, MSVCRT and COREDLL are mutually
> exclusive. 


Yes, they are mutually exclusive.


> If this is the case, I see no overlap between x86 mingw
> and CE mingw in crt1.c.  I fear the cost of maintaining the ifdef's
> will be larger than the cost of maintaining a separate file for CE's
> crt1.c.
>
>   
>> Yes, I also think it would be simpler. But, it requires a gcc change
>> (simple one, I think). Currently the __gccmain call is emitted on main,
>>     
>
> I don't see why - we can call __gccmain explicitly from the CRT code.
> If it gets called again, the subsequent calls will just be ignored.
>
>   

That is correct.


> Attached is a patch that implements a new crt1_ce.c and winmain_ce.c.
> With these new files, no changes from x86 mingw are needed to crt1.c
> or main.c.  Ideally, one should move all the recent CE specific
> changes in init.c into winmain_ce.c -- that way no changes to init.c
> would be necessary either.
>
> I hope you'll agree that the new files make the process much easier to
> understand and will make the changes easier to merge upstream.
>
> I've only tested this with haret (a WinMain app) on a CE5 pda.
>
> Comments?
>
>   

Not much to say. I am sold.
I am really with almost no time to work on this, so perhaps you want to
continue the work on those cleanups in init.c?

I was worried with what would happen if some weirdo CE app
used __argc/__argv directly, so I quickly tested the snipped below on MSVC
to see what corelibc does to __argc and __argv when the user entry point is 
WinMain.
Well, it prints 0, so it does nothing. Your patch makes us behave the
same as corelibc, so I see no problems.

extern int __argc;

int WINAPI WinMain(HINSTANCE hInstance,
                    HINSTANCE hPrevInstance,
                    LPTSTR    lpCmdLine,
                    int       nCmdShow)
{
     printf ("__argc = %d\n", __argc);
     return 0;
}


Could you post then a final version with a ChangeLog entry?

Thanks!

Cheers,
Pedro Alves




-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Cegcc-devel mailing list
Cegcc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cegcc-devel

Reply via email to