public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Jay K <jayk123@hotmail.com>
To: "cygwin@sourceware.org" <cygwin@sourceware.org>
Subject: ExitProcess does not work in Cygwin?
Date: Thu, 13 Jan 2022 06:39:01 +0000	[thread overview]
Message-ID: <MWHPR1401MB1951896B7184CC9CC408CD07E6539@MWHPR1401MB1951.namprd14.prod.outlook.com> (raw)

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

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

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-13  6:39 Jay K [this message]
2022-01-13 13:40 ` Eliot Moss
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=MWHPR1401MB1951896B7184CC9CC408CD07E6539@MWHPR1401MB1951.namprd14.prod.outlook.com \
    --to=jayk123@hotmail.com \
    --cc=cygwin@sourceware.org \
    /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).