My program restarts six times under Cygwin when run under rxvt/xterm

Christopher Faylor
Wed May 16 18:54:00 GMT 2007

On Wed, May 16, 2007 at 11:14:36AM -0700, Alex Shturm wrote:
>cgf wrote:
>>Cygwin uses the equivalent of SetUnhandledExceptionFilter for its own
>>purposes.  It can do that because there is no linux version of that
>>So, if you attempt to use it in a cygwin-aware program, you're in for
>>problems.  If you need to produce pure windows programs, I'd suggest
>> .  It doesn't seem like you need Cygwin for the
>This small program is just a tiny part of a huge application, which is 
>built natively on Windows, and intended to be run without Cygwin by the 

If it is going to be run without Cygwin then you shouldn't be using
cygwin's gcc.

>However we in development use Cygwin extensively, mostly to use the same 
>scripts/environment as on Unix platforms (where our application is also 

You may be a little confused here.  I'm not suggesting that you have to
wipe cygwin from your hard drive to use MinGW.  For the most part,
Cygwin runs standard windows applications, like the MinGW build tools,
just fine.

>Hence your suggestion to use mingw is not applicable in our case. Out 
>application is not cygwin-aware.

If you are using gcc to build your program then you are building a
cygwin application regardless of whether you use anything from the
cygwin API.  Cygwin is a *dll* it will get loaded automatically when
you start your program and it will do things with exception handling.

Btw, if you build your program with standard cygwin gcc is also GPLed,
which means that you must provide source code for the program to your

>Still something does not look right to me:
>(1) Even if cygwin has its own exception handling, how is it possible 
>that it interferes with exception handling in my program (which is a 
>separate process) ?

see above.

>(2) Why this issue is not reproducible when cygwin shell is started in a 
>regular (cmd?) window, but reproducible only in rxvt/xterm window?

Dunno but I'm not particularly interested in finding out.  I know for
sure that if you do what you're doing you will have problems.

>I wonder if somebody can take a look at it...

It's not likely.  Sorry.  You really should just make your program a
pure windows program.  It will still run under rxvt, bash, etc.  but it
isn't likely that it will manifest this problem and you won't have to
provide your source code to your customers under the GPL.

You can also use the -mno-cygwin option to gcc which will avoid using
the cygwin environment when compiling/linking.  I avoided mentioning
this before because it is a constant source of confusion with people
because it doesn't always work 100% correctly and people somehow think
that it is a way to avoid the GPL but still have cygwin functionality.
It may work in your case but MinGW is cleaner.


Unsubscribe info:
Problem reports:

More information about the Cygwin-xfree mailing list