Skip to content

Instantly share code, notes, and snippets.

View agocke's full-sized avatar

Andy Gocke agocke

View GitHub Profile
@agocke
agocke / tests.cs
Created September 7, 2017 19:28
Interesting output from local functions
public class C {
public void M() {
int x = 0;
{
int y = 0;
// Captures two struct closures
int L() => x + y;
}
}
class C
{
[DllImport...]
private static extern IntPtr GetAHandle();
private static Task WrapHandle()
{
var handle = GetAHandle();
var tcs = new TaskCompletionSource();
Task.Run(() =>
20000100000
20000100000
20000100000
20000100000
20000100000
20000100000
; Assembly listing for method Name.Program:IfeHelper(struct):long:this
; Emitting BLENDED_CODE for X64 CPU with AVX
; optimized code
; rbp based frame
static extern void MyPInvoke(IntPtr ptrToCstr)
static void Main()
{
IntPtr ptr = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(IntPtr)));
try
{
MyPInvoke(ptr);
IntPtr cstrPtr = Marshal.PtrToStructure(ptr, typeof(IntPtr))