Example #1
0
        ///////////////////////////////////////////////////////////////////////

        private static void UnsetNativeDelegates()
        {
            lock (syncRoot) /* TRANSACTIONAL */
            {
                nativeGetVersion     = null;
                nativeAllocateMemory = null;
                nativeFreeMemory     = null;
                nativeFreeElements   = null;
                nativeSplitList      = null;
                nativeJoinList       = null;

                RuntimeOps.UnsetNativeDelegates(nativeDelegates, null);
            }
        }
Example #2
0
        ///////////////////////////////////////////////////////////////////////

        private static bool SetNativeDelegates(
            ref Result error
            )
        {
            lock (syncRoot) /* TRANSACTIONAL */
            {
                if ((RuntimeOps.SetNativeDelegates(
                         "utility API", nativeModule, nativeDelegates,
                         null, ref error) == ReturnCode.Ok) &&
                    (nativeDelegates != null))
                {
                    try
                    {
                        nativeGetVersion = (Eagle_GetVersion)
                                           nativeDelegates[typeof(Eagle_GetVersion)];

                        nativeAllocateMemory = (Eagle_AllocateMemory)
                                               nativeDelegates[typeof(Eagle_AllocateMemory)];

                        nativeFreeMemory = (Eagle_FreeMemory)
                                           nativeDelegates[typeof(Eagle_FreeMemory)];

                        nativeFreeElements = (Eagle_FreeElements)
                                             nativeDelegates[typeof(Eagle_FreeElements)];

                        nativeSplitList = (Eagle_SplitList)
                                          nativeDelegates[typeof(Eagle_SplitList)];

                        nativeJoinList = (Eagle_JoinList)
                                         nativeDelegates[typeof(Eagle_JoinList)];

                        return(true);
                    }
                    catch (Exception e)
                    {
                        error = e;
                    }
                }
            }

            return(false);
        }