diff --git a/compiler/catch.pas b/compiler/catch.pas
index 9f816ed2e2..3ee23aae96 100644
--- a/compiler/catch.pas
+++ b/compiler/catch.pas
@@ -65,7 +65,7 @@ uses
 {$ifdef unix}
 Procedure CatchSignal(Sig : Longint);cdecl;
 {$else}
-Function CatchSignal(Sig : longint):longint;
+Function CatchSignal(Sig : longint):longint; cdecl;
 {$endif}
 begin
   case Sig of
diff --git a/rtl/go32v2/dpmiexcp.pp b/rtl/go32v2/dpmiexcp.pp
index 3fb9e3880b..51c1eeb35b 100644
--- a/rtl/go32v2/dpmiexcp.pp
+++ b/rtl/go32v2/dpmiexcp.pp
@@ -1544,6 +1544,23 @@ begin
 {$endif CREATE_C_FUNCTIONS}
 end.
 {$else IN_SYSTEM}
+
+{ Default handler for SIGINT. Default action is to quit silently.
+  However, if a CtrlBreakHandler has been installed, call it and continue if
+  it returned true.
+  If you want RTE 217 to be generated, use HandleException instead as the
+  SIGINT handler }
+function SIGINT_Handler(x:longint):longint;cdecl;
+var
+  iscbreak : boolean;
+begin
+  iscbreak:=assigned(djgpp_exception_state_ptr) and
+    (djgpp_exception_state_ptr^.__signum=$1b);
+  if assigned(CtrlBreakHandler) and CtrlBreakHandler(iscbreak) then
+    exit(0); //no need to do cleanups, dpmi_longjmp will do it for us
+  halt;
+end;
+
 const
   FPU_ControlWord : word = $1332;
 function HandleException(sig : longint) : longint;cdecl;
@@ -1608,8 +1625,9 @@ begin
    17,                     {'Alignment Check',}
    18,                     {'Machine Check',}
    19,                     {'SSE FP error'}
-   SIGSEGV,SIGTRAP,SIGTIMR,SIGINT,SIGQUIT,SIGILL:
+   SIGSEGV,SIGTRAP,SIGTIMR,SIGQUIT,SIGILL:
      ErrorOfSig:=216;
+   $1b, $79, SIGINT : ErrorOfSig:=217;
   end;
   if assigned(djgpp_exception_state_ptr) then
     Begin
@@ -1633,7 +1651,7 @@ begin
   Signal(SIGNOFP,@HandleException);
   Signal(SIGTRAP,@HandleException);
   Signal(SIGTIMR,@HandleException);
-  Signal(SIGINT,@HandleException);
+  Signal(SIGINT,@SIGINT_Handler);
   Signal(SIGQUIT,@HandleException);
   Signal(SIGILL,@HandleException);
 end;