Hello,
I have searched a while why old VC console programs doesn't work now.
The reason is a change in the number of arguments .
Old:
main PROTO C argc:DWORD ,argv:XMASM (XMASM= DWORD in 32,Qword in 64)
New:
Quote
;-----main( int argc, char *argv[ ], char *envp[ ] );-------------------
main PROTO C argc:DWORD ,argv:XMASM ,envp:XMASM
the WinMain don't seem to have changed.
Quote
;int WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd);
WinMain PROTO hInstance:HINSTANCE ,hPrevInstance:HINSTANCE ,lpCmdLine:XMASM ,nShowCmd:DWORD
With WinMain there is to take care than some headers describe it with __clrcall
To be an Entry Point only the stdcall work (msdn)
Using this two defines with the ucrt.lib and the msvcrt.lib give a complete integration with the crt.
The lpCmdLine return a pointer on the command line ,argc return the number of argument.
main,wmain(UNICODE) works with the Link /SUBSYSTEM:CONSOLE.
WinMain,wWinMain(UNICODE) works with the link /SUBSYSTEM:WINDOWS
Quote
The two are recognized by the crt as entry point and there is no need of link /ENTRY
The exitprocess is optionnal,he is done after the end of the prog in the (W)maincrtstartup.
Tested in 32 bits,perhaps is there little modifies in 64