# HG changeset patch # User Wuzzy # Date 1538508385 -7200 # Node ID cf7626f46bb2c58393775b60d7b3a4f5219672fd # Parent db1b680bd8d320ee727f004d547406d617e1c6d2 IFNDEF custom exception handlung away in pas2c builds diff -r db1b680bd8d3 -r cf7626f46bb2 hedgewars/hwengine.pas --- 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();