Le vendredi 21 novembre 2014, 17:53:50 Carlos Montiers a écrit :
> Hello. The executables compiled with tiny c should run on windows 98?.
> 
> I ask this, because, windows 98 use msvcrt.dll v6.0 and is different than
> msvcrt.dll v7.0
> 
> For example, the sources for the crt for __getmainargs function
> 
> in the visual studio 98 (v6.0) prototype is:
> _CRTIMP void __cdecl __wgetmainargs
> and in visual studio 2010 (v7.0) the prototype is:
> _CRTIMP int __cdecl __wgetmainargs
> 
> v6.0 says:
> Exit: No return value. Values for the arguments to main() are copied
> through the passed pointers.
> And in the function _setargv (that call):
> Exceptions: Terminates with out of memory error if no memory to allocate.
> 
> v7.0 says:
> Exit: Returns 0 on success, negative if _*setargv returns an error. Values
> for the arguments to main() are copied through the passed pointers.
> 
> Because this, I think if we want compatibility with this two versions of
> msvcrt.dll we cannot use the return value for check success, because v6.0
> return void.
> 
> I propose this way for check the success of the function:
> 
>     argv = NULL;
>     __getmainargs(&argc, &argv, &env, 0, &start_info);
>     // check success of __getmainargs comparing argv with NULL
>     if (! argv) {
>         ExitProcess(-1);
>     }
> 
> Some comments about this?

Sounds reasonnable but note that I don't know anything about programming on 
Windows right now. Adding grishka in the loop for an opinion.

Thanks for the detailed explaination by the way.

Best regards,

Thomas

_______________________________________________
Tinycc-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

Reply via email to