SetLastError |
Top Previous Next |
PInvoke > SetLastError The default attributes that Delphi2C# creates for Windows API calls are:
[DllImport(kernel32, SetLastError=true)]
"SetLastError=true" asserts, that additional error information (an unsigned 32 bit error code), which can be retrieved by a call of "GetLastError", is not overwritten with errors, which might be caused of the CLR, after the call returns from unmanaged to managed code.
Though it makes sense to set this attribute only for calls, which can change the last error, Delphi2C# cannot distinguish these cases and always sets this attribute.It doesn't harm in those case, where it wouldn't be useful. |
This page belongs to the Delphi2C# Documentation |
Delphi2C# home Content |