示例#1
0
        public void Dispose()
        {
#if UNITY_EDITOR_OSX
            if (_dlHandler == IntPtr.Zero)
            {
                return;
            }

            // 読み込んだDLLを破棄する
            File.Delete(_tempFile);

            if (dlclose(_dlHandler) != 0)
            {
                throw new Exception($"failed to unload DLL: {Marshal.PtrToStringAnsi(dlerror())}");
            }

            _dlHandler = IntPtr.Zero;
#elif UNITY_EDITOR_WIN
            _handle?.Dispose();

            // 読み込んだDLLを破棄する
            File.Delete(_tempFile);
#endif
        }
示例#2
0
        ///// <summary>
        ///// Convert JSON string into BsonDocument.
        ///// Returns `null` if conversion failed.
        ///// </summary>
        ///// <returns>The BsonDocument instance on success.</returns>
        ///// <param name="json">JSON string</param>
        //public BsonDocument Json2Bson(string json)
        //{
        //	IntPtr jsonptr = Plaform.NativeUtf8FromString(json);
        //	try
        //	{
        //		using (var Bson = new BsonHandle())_jsonToBson(jsonptr))
        //		{
        //			return ConvertToBsonDocument(Bson);
        //		}
        //	}
        //	finally
        //	{
        //		Marshal.FreeHGlobal(jsonptr); //UnixMarshal.FreeHeap(jsonptr);
        //	}
        //}

        /// <summary>
        /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
        /// </summary>
        /// <filterpriority>2</filterpriority>
        public void Dispose()
        {
            LibraryHandle.Dispose();
        }