[fpc-devel]Minor differences with Delphi
Marco van de Voort
marcov at stack.nl
Sat Nov 8 13:19:08 CET 2003
> On Fri, 2003-11-07 at 12:55, David Butler wrote:
> > Sorry, I should have guessed. Yes, it basically takes the OS error and
> > raises some exception. The exception message is the OS error message
> > as returned by an OS function call.
>
> Here's a basic implementation that works for me (*):
>
> const
> StrOSError : string = 'System error (number %d).'+LineEnding+'%s';
>
> type
> EOSError = class(Exception)
> end;
>
> procedure RaiseLastOSError;
> var
> LError: integer;
> begin
> LError := GetLastError;
> raise EOSError.CreateFmt(StrOSError,[LError,StrError(LError)]);
> end;
>
> (*) for linux, GetLastError is not defined in system.pp. It should be
> (to be Delphi compatible), and this works:
>
> function GetLastError: Integer;
> begin
> Result := fpGetErrno;
> end;
I will look into this tomorrow.
More information about the fpc-devel
mailing list