public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Eliot Moss <moss@cs.umass.edu>
To: Jay K <jayk123@hotmail.com>,
	"cygwin@sourceware.org" <cygwin@sourceware.org>
Subject: Re: ExitProcess does not work in Cygwin?
Date: Thu, 13 Jan 2022 08:40:19 -0500	[thread overview]
Message-ID: <1f98eb84-e3d7-bf0d-875c-3d4818e41aef@cs.umass.edu> (raw)
In-Reply-To: <MWHPR1401MB1951896B7184CC9CC408CD07E6539@MWHPR1401MB1951.namprd14.prod.outlook.com>

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

  reply	other threads:[~2022-01-13 13:40 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-13  6:39 Jay K
2022-01-13 13:40 ` Eliot Moss [this message]
2022-01-13 17:07   ` Kaz Kylheku (Cygwin)
2022-01-13 17:19     ` Brian Inglis
2022-01-13 23:15       ` Jay K
2022-01-14  6:19         ` Brian Inglis
2022-01-26 14:23         ` Andrey Repin
2022-01-26 17:06           ` Jay K

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1f98eb84-e3d7-bf0d-875c-3d4818e41aef@cs.umass.edu \
    --to=moss@cs.umass.edu \
    --cc=cygwin@sourceware.org \
    --cc=jayk123@hotmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).