[fpc-devel]Minor differences with Delphi

Johannes Berg johannes at sipsolutions.com
Sat Nov 8 13:04:43 CET 2003


On Sat, 2003-11-08 at 12:41, Johannes Berg wrote:
> Here's a basic implementation that works for me (*):

And before someone complains about Delphi compatibility:

type
  EOSError = class(Exception)
  protected
    FErrorCode: Integer;
  public
    property ErrorCode: Integer read FErrorCode;
  end;

procedure RaiseLastOSError;
var
  LError: integer;
  LErrExc: EOSError;
begin
  LError := GetLastError;
  LErrExc := EOSError.CreateFmt(StrOSError,[LError,StrError(LError)]);
  LErrExc.FErrorCode := LError;
  raise LErrExc;
end;

johannes
-- 
http://www.sipsolutions.de/
GnuPG key: http://www.sipsolutions.de/keys/JohannesBerg.asc
  Key-ID: 9AB78CA5 Johannes Berg <johannes at sipsolutions.de>
  Fingerprint = AD02 0176 4E29 C137 1DF6 08D2 FC44 CF86 9AB7 8CA5
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 194 bytes
Desc: This is a digitally signed message part
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20031108/24172aca/attachment.sig>


More information about the fpc-devel mailing list