Skip to content

Commit

Permalink
Add example that runs on Windows to the demo project.
Browse files Browse the repository at this point in the history
It is interesting to step into the generated method and observe the UX.
  • Loading branch information
AaronRobinsonMSFT committed Jul 13, 2020
1 parent f9f705c commit 35c9adc
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions DllImportGenerator/Demo/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,19 @@

namespace Demo
{
partial class Kernel32
{
[GeneratedDllImport(nameof(Kernel32), EntryPoint = "QueryPerformanceCounter")]
public static partial int Method(ref long t);
}

unsafe class Program
{
static void Main(string[] args)
{
var ts = (long)0;
int suc = Kernel32.Method(ref ts);
Console.WriteLine($"{suc}: 0x{ts:x}");
}
}
}

0 comments on commit 35c9adc

Please sign in to comment.