Exemple #1
0
        public static ValueTuple <UnmanagedSourceFunc, UnmanagedDestroyNotify, IntPtr> CreateNotifyDelegate(SourceFunc func)
        {
            var data = new UnmanagedSourceData {
                IsAsync         = false,
                Func            = func,
                UnmanagedFunc   = UnmanagedFunc,
                UnmanagedNotify = UnmanagedNotify,
            };
            var gcHandle = GCHandle.Alloc(data);

            return(data.UnmanagedFunc, data.UnmanagedNotify, (IntPtr)gcHandle);
        }
Exemple #2
0
        public static ValueTuple <UnmanagedSourceFunc, IntPtr> CreateDelegate(SourceFunc func, bool isAsync = false)
        {
            var data = new UnmanagedSourceData {
                IsAsync         = isAsync,
                Func            = func,
                UnmanagedFunc   = UnmanagedFunc,
                UnmanagedNotify = null,
            };
            var gcHandle = GCHandle.Alloc(data);

            return(data.UnmanagedFunc, (IntPtr)gcHandle);
        }