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

--
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

Reply via email to