核心提示:unit uInitExceptions;{Streamlined By BinJian in sleepless.}interfacetype{ Exceptions }Exception = cl...
unit uInitExceptions; { Streamlined By BinJian in sleepless. } interface type { Exceptions } Exception = class(TObject) private FMessage: string; public constructor Create(const Msg: string); end; ExceptClass = class of Exception; implementation { Exception class } constructor Exception.Create(const Msg: string); begin FMessage := Msg; end; function GetExceptionClass(P: Pointer): ExceptClass; begin Result := Exception; end; procedure ErrorHandler(ErrorCode: Byte; ErrorAddr: Pointer); export; var E: Exception; begin E := nil; raise E at ErrorAddr; end; function GetExceptionObject(P: Pointer): Exception; begin Result := Exception.Create('Exception happenned.'); end; procedure ExceptHandler(ExceptObject: TObject; ExceptAddr: Pointer); far; begin Halt(1); end; procedure InitExceptions; begin ErrorProc := ErrorHandler; ExceptProc := @ExceptHandler; ExceptionClass := Exception; {$IFDEF MSWINDOWS} ExceptClsProc := @GetExceptionClass; ExceptObjProc := @GetExceptionObject; {$ENDIF} end; initialization InitExceptions; end.