tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Tinycc-devel] tiny c executable will run on windows 98, getmainargs ?


From: Carlos Montiers
Subject: [Tinycc-devel] tiny c executable will run on windows 98, getmainargs ?
Date: Fri, 21 Nov 2014 17:53:50 -0300

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?

Tiny c executables should run on windows 98 ?


Carlos



reply via email to

[Prev in Thread] Current Thread [Next in Thread]