Ejemplo n.º 1
0
        public static ValueTuple <UnmanagedLogFunc, UnmanagedDestroyNotify, IntPtr> CreateNotifyDelegate(LogFunc func)
        {
            var data = new UnmanagedLogFuncFuncData {
                IsAsync         = false,
                Func            = func,
                UnmanagedFunc   = UnmanagedFunc,
                UnmanagedNotify = UnmanagedNotify,
            };
            var gcHandle = GCHandle.Alloc(data);

            return(data.UnmanagedFunc, data.UnmanagedNotify, (IntPtr)gcHandle);
        }
Ejemplo n.º 2
0
        public static ValueTuple <UnmanagedLogFunc, IntPtr> CreateDelegate(LogFunc func, bool isAsync = false)
        {
            var data = new UnmanagedLogFuncFuncData {
                IsAsync         = isAsync,
                Func            = func,
                UnmanagedFunc   = UnmanagedFunc,
                UnmanagedNotify = null,
            };
            var gcHandle = GCHandle.Alloc(data);

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