예제 #1
0
        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));
        }
예제 #2
0
            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));
            }
예제 #3
0
        private static MergeOperator GetMergeOperatorFromPtr(IntPtr getMergeOperatorPtr)
        {
            var getMergeOperator = CurrentFramework.GetDelegateForFunctionPointer <GetMergeOperator>(getMergeOperatorPtr);

            return(getMergeOperator());
        }