private unsafe int Comparator_Compare(IntPtr state, IntPtr a, UIntPtr alen, IntPtr b, UIntPtr blen)
        {
            var getComparatorPtr = (*((ComparatorState *)state)).GetComparatorPtr;
            var getComparator    = CurrentFramework.GetDelegateForFunctionPointer <GetComparator>(getComparatorPtr);
            var comparator       = getComparator();

            return(comparator.Compare(a, alen, b, blen));
        }
            public static T LoadFunc <T>(INativeLibImporter importer, IntPtr libraryHandle, string entryPoint)
            {
                IntPtr procAddress = importer.GetProcAddress(libraryHandle, entryPoint);

                if (procAddress == IntPtr.Zero)
                {
                    throw new NativeLoadException(string.Format("Unable to get address of {0} ({1})", entryPoint, typeof(T)), null);
                }
                return(CurrentFramework.GetDelegateForFunctionPointer <T>(procAddress));
            }
Esempio n. 3
0
        private static MergeOperator GetMergeOperatorFromPtr(IntPtr getMergeOperatorPtr)
        {
            var getMergeOperator = CurrentFramework.GetDelegateForFunctionPointer <GetMergeOperator>(getMergeOperatorPtr);

            return(getMergeOperator());
        }