Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert activation and error info delegates to function pointers #1018

Merged
merged 3 commits into from
Oct 11, 2021

Conversation

jkotas
Copy link
Member

@jkotas jkotas commented Oct 11, 2021

Avoids overhead of creating the marshaled delegates

Avoids overhead of creating the marshaled delegates

internal delegate int SetRestrictedErrorInfo(IntPtr pRestrictedErrorInfo);
private static SetRestrictedErrorInfo setRestrictedErrorInfo;
private static readonly bool initialized = Initialize();
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This pattern avoids precise static constructor that was here before. The precise static constructor adds overhead to all static methods in the type. The overhead was visible on the ThrowExceptionForHR method.

@jkotas
Copy link
Member Author

jkotas commented Oct 11, 2021

@manodasanW PTLA

@@ -4,6 +4,7 @@
namespace WinRT.Interop
{
[Guid("11D3B13A-180E-4789-A8BE-7712882893E6")]
[StructLayout(LayoutKind.Sequential)]
Copy link
Member Author

@jkotas jkotas Oct 11, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a convenient way to silence unused field warnings in structs like this.

@manodasanW
Copy link
Member

Thanks @jkotas for this change.

@manodasanW
Copy link
Member

/azp run

@azure-pipelines
Copy link

No pipelines are associated with this pull request.

@manodasanW
Copy link
Member

/azp run

@azure-pipelines
Copy link

No pipelines are associated with this pull request.

@manodasanW manodasanW merged commit 4035ab8 into microsoft:master Oct 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants