--- a/hedgewars/hwengine.pas Tue Oct 02 20:33:33 2018 +0200
+++ b/hedgewars/hwengine.pas Tue Oct 02 21:26:25 2018 +0200
@@ -45,15 +45,19 @@
procedure preInitEverything();
procedure initEverything(complete:boolean);
procedure freeEverything(complete:boolean);
+{$IFNDEF PAS2C}
procedure catchUnhandledException(Obj: TObject; Addr: Pointer; FrameCount: Longint; Frames: PPointer);
+{$ENDIF}
implementation
{$ELSE}
procedure preInitEverything(); forward;
procedure initEverything(complete:boolean); forward;
procedure freeEverything(complete:boolean); forward;
+{$IFNDEF PAS2C}
procedure catchUnhandledException(Obj: TObject; Addr: Pointer; FrameCount: Longint; Frames: PPointer); forward;
{$ENDIF}
+{$ENDIF}
{$IFDEF WIN32}
type TSetProcessDpiAwareness = function(value: Integer): Integer; stdcall;
@@ -600,6 +604,7 @@
freeEverything(false);
end;
+{$IFNDEF PAS2C}
// Write backtrace to console and log when an unhandled exception occurred
procedure catchUnhandledException(Obj: TObject; Addr: Pointer; FrameCount: Longint; Frames: PPointer);
var
@@ -621,6 +626,7 @@
WriteLnToConsole(BackTraceStrFunc(Frames[i]));
end;
end;
+{$ENDIF}
{$IFDEF HWLIBRARY}
function RunEngine(argc: LongInt; argv: PPChar): LongInt; cdecl; export;
@@ -649,8 +655,10 @@
// workaround for pascal's ParamStr and ParamCount
init(argc, argv);
{$ENDIF}
+{$IFNDEF PAS2C}
// Custom procedure for unhandled exceptions; ExceptProc is used by sysutils module
ExceptProc:= @catchUnhandledException;
+{$ENDIF}
preInitEverything();