Skip to content
This repository was archived by the owner on Jul 26, 2023. It is now read-only.

Generate IntPtr overloads for BCrypt native pointer methods #117

Merged
merged 6 commits into from
Dec 19, 2015

Conversation

AArnott
Copy link
Collaborator

@AArnott AArnott commented Dec 17, 2015

Introduces code generation that automatically adds IntPtr overloads of methods with native pointers.

This will close #95 when merged to master. I'm merging to a staging branch for now so we can review it without also re-reviewing the changes to bcrypt and advapi32 that removed the intptr overloads.

Design

We rely on the new CodeGeneration.Roslyn nuget package for the framework in which we generate code. This frees us from much of the grunt work of code generation such as .targets and MSBuild Task authoring, locked files, etc. We can adjust the code generation code in VS and build the solution without any reloading and it immediately takes effect. We can even hit F5 and debug the code generation itself which of course can turn in handy.
All extra dependencies (on the nuget package and assemblies defining attributes and code generation) evaporate during the build. No references remain so the end user is not impacted.

The IntPtr overloads are generated into files that are created in the intermediate output directory. They are added to @(Compile) so the same assembly and same type that contains the native pointer method also contains the IntPtr overload. This generated code is available at design-time, so you can Go to Definition on it, find it in the member jump list at the top of the document, etc.

@AArnott
Copy link
Collaborator Author

AArnott commented Dec 17, 2015

In its present form, it only generates code for BCrypt. I'll work on adding AdvApi32.dll in an update to this same PR soon.

@jmelosegui
Copy link
Collaborator

LGTM 👍

AArnott added a commit that referenced this pull request Dec 19, 2015
Generate IntPtr overloads for BCrypt native pointer methods
@AArnott AArnott merged commit 87ee3cc into intptr_codegen_merged Dec 19, 2015
@AArnott AArnott deleted the intptr_codegen branch December 19, 2015 16:10
AArnott added a commit that referenced this pull request Oct 30, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants