[Mingw-users] Problems with compiling Windows system calls with MinGW gcc 6.3.0

Back to archive index

Eli Zaretskii eliz****@gnu*****
Thu Aug 2 01:52:00 JST 2018


> From: Keith Marshall <keith****@users*****>
> Date: Wed, 1 Aug 2018 17:32:16 +0100
> 
> The problem is that Microsoft changed the return type, a few years ago,
> from "int", (which is what the rest of the *nix world still uses), to
> "intptr_t".

To be consistent with spawn* functions, which can return a handle to
the process they start.

> The simplest solution would be to either[**]:
> 
>   - remove the offending prototypes from the OLDNAMES section of our
>     mingwrt <process.h>, or ...
> 
>   - leave the OLDNAMES prototypes in place, but revert the return
>     type to "int", (as g++ wants it, and POSIX says it should be).
> 
> [*] Actually, I'd advise against using these Microsoft functions anyway;
> if they successfully create a child process, then the calling process
> terminates, without providing any mechanism for its parent to wait for,
> or even identify the child.

exec* functions make little sense without fork, yes.  Moreover, I
needed to replace exec* with the corresponding spawn*, because the
former caused trouble with keyboard input, see the Gawk sources.

> [**] There's actually a third option: ignore the testsuite failure!  The
> issue isn't even apparent, unless compiling with -Wsystem-headers, (as
> the testsuite does), and even then it only raises warnings, (unless
> -Werror is also enabled).

If a C++ program invoking one of these functions compiles without
errors, then maybe the third option is the best.  I assumed, perhaps
incorrectly, that the test suite failure means C++ programs using
these functions (or even including <process.h>?) will fail to compile
or link.




More information about the MinGW-Users mailing list
Back to archive index