aboutsummaryrefslogtreecommitdiff
path: root/src/ARMeilleure/Translation/DelegateInfo.cs
blob: 36320ac31752a16d4a2a8e8ed9b54a47ddb3990c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
using System;
using System.Runtime.InteropServices;

namespace ARMeilleure.Translation
{
    class DelegateInfo
    {
        private readonly Delegate _dlg; // Ensure that this delegate will not be garbage collected.

        public IntPtr FuncPtr { get; }

        public DelegateInfo(Delegate dlg)
        {
            _dlg = dlg;

            FuncPtr = Marshal.GetFunctionPointerForDelegate<Delegate>(dlg);
        }
    }
}