-
Notifications
You must be signed in to change notification settings - Fork 206
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Collect DllImport details through Roslyn semantic model (#36)
* Collect DllImport details through Roslyn semantic model Create an assembly that provides the GeneratedDllImportAttribute which allows use of the semantic model. * Collect MarshalAsAttribute data * Collect MarshalAsAttribute data Convert P/Invoke centric data structures to handle positional type information for managed/unmanaged scenarios.
- Loading branch information
1 parent
48b8361
commit 21e634e
Showing
13 changed files
with
647 additions
and
214 deletions.
There are no files selected for viewing
8 changes: 8 additions & 0 deletions
8
DllImportGenerator/Ancillary.Interop/Ancillary.Interop.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net5.0</TargetFramework> | ||
<LangVersion>8.0</LangVersion> | ||
</PropertyGroup> | ||
|
||
</Project> |
25 changes: 25 additions & 0 deletions
25
DllImportGenerator/Ancillary.Interop/GeneratedDllImportAttribute.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#nullable enable | ||
|
||
namespace System.Runtime.InteropServices | ||
{ | ||
// [TODO] Remove once the attribute has been added to the BCL | ||
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)] | ||
public sealed class GeneratedDllImportAttribute : Attribute | ||
{ | ||
public bool BestFitMapping; | ||
public CallingConvention CallingConvention; | ||
public CharSet CharSet; | ||
public string? EntryPoint; | ||
public bool ExactSpelling; | ||
public bool PreserveSig; | ||
public bool SetLastError; | ||
public bool ThrowOnUnmappableChar; | ||
|
||
public GeneratedDllImportAttribute(string dllName) | ||
{ | ||
this.Value = dllName; | ||
} | ||
|
||
public string Value { get; private set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.