Skip to content

Commit

Permalink
PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
elinor-fung committed Nov 21, 2020
1 parent e66a880 commit eb1af69
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion DllImportGenerator/DllImportGenerator/StubCodeGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ internal sealed class StubCodeGenerator : StubCodeContext
private const string InvokeReturnIdentifier = "__invokeRetVal";
private const string LastErrorIdentifier = "__lastError";

// Error code representing success. This maps to S_OK for Windows HRESULT semantics and 0 for POSIX errno semantics.
private const int SuccessErrorCode = 0;

private static readonly Stage[] Stages = new Stage[]
{
Stage.Setup,
Expand Down Expand Up @@ -254,7 +257,7 @@ public override (string managed, string native) GetIdentifiers(TypePositionInfo
ParseName(TypeNames.System_Runtime_InteropServices_MarshalEx),
IdentifierName("SetLastSystemError")),
ArgumentList(SingletonSeparatedList(
Argument(LiteralExpression(SyntaxKind.NumericLiteralExpression, Literal(0)))))));
Argument(LiteralExpression(SyntaxKind.NumericLiteralExpression, Literal(SuccessErrorCode)))))));

// <lastError> = Marshal.GetLastSystemError();
var getLastError = ExpressionStatement(
Expand Down

0 comments on commit eb1af69

Please sign in to comment.