[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Tinycc-devel] tiny c executable will run on windows 98, getmainargs
From: |
Thomas Preud'homme |
Subject: |
Re: [Tinycc-devel] tiny c executable will run on windows 98, getmainargs ? |
Date: |
Sat, 03 Jan 2015 21:49:36 +0000 |
User-agent: |
KMail/4.14.1 (Linux/2.6.38-ac2-ac100; KDE/4.14.2; armv7l; ; ) |
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
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [Tinycc-devel] tiny c executable will run on windows 98, getmainargs ?,
Thomas Preud'homme <=