ExitProcess does not work in Cygwin?

Eliot Moss moss@cs.umass.edu
Thu Jan 13 13:40:19 GMT 2022


On 1/13/2022 1:39 AM, Jay K wrote:
> ExitProcess does not work in Cygwin?
>> $ rm *.exe
>> # u is for Unix
> # w is for Windows
>> $ cat u.c
> #include <stdlib.h>
> int main()
> {
> exit(1);
> }
>> $ gcc u.c
> $ ./a.exe
>> $ echo $?
> 1
>> => as expected
>> $ cat w.c
> #include <windows.h>
>> int main()
> {
> ExitProcess(1);
> }
>> $ gcc w.c
> $ ./a.exe
>> $ echo $?
> 0
>> => not expected
>> $ uname -a
> CYGWIN_NT-10.0 jayk-tp4 3.3.3(0.341/5/3) 2021年12月03日 16:35 x86_64 Cygwin
>> works in debugger:
>> $ /cygdrive/c/bin/amd64/windbg.exe .\\a.exe
>> $ echo $?
> 1
>> ?
>> - Jay

ExitProcess does not appear to be a POSIX function. Cygwin strives to provide a
POSIX-like interface, not a Windows-like one. However, if ExitProcess is a Windows
function, there is probably a library you can use to obtain it in Cygwin (maybe
the winsup (Windows support) library).
Eliot Moss


More information about the Cygwin mailing list

AltStyle によって変換されたページ (->オリジナル) /