ToPointer() private method

private ToPointer ( ) : void*
return void*
示例#1
1
        [System.Security.SecuritySafeCritical]  // auto-generated
        internal unsafe static Type GetTypeHelper(Type typeStart, Type[] genericArgs, IntPtr pModifiers, int cModifiers)
        {
            Type type = typeStart;

            if (genericArgs != null)
            {
                type = type.MakeGenericType(genericArgs);
            }

            if (cModifiers > 0)
            {
                int* arModifiers = (int*)pModifiers.ToPointer();
                for(int i = 0; i < cModifiers; i++)
                {
                    if ((CorElementType)Marshal.ReadInt32((IntPtr)arModifiers, i * sizeof(int)) == CorElementType.Ptr)
                        type = type.MakePointerType();
                    
                    else if ((CorElementType)Marshal.ReadInt32((IntPtr)arModifiers, i * sizeof(int)) == CorElementType.ByRef)
                        type = type.MakeByRefType();

                    else if ((CorElementType)Marshal.ReadInt32((IntPtr)arModifiers, i * sizeof(int)) == CorElementType.SzArray)
                        type = type.MakeArrayType();

                    else
                        type = type.MakeArrayType(Marshal.ReadInt32((IntPtr)arModifiers, ++i * sizeof(int)));
                }
            }
            
            return type;
        }
示例#2
0
        private static FMOD.RESULT FMOD_EVENT_CALLBACK(IntPtr eventraw, FMOD.EVENT_CALLBACKTYPE type, IntPtr param1, IntPtr param2, IntPtr userdata)
        {
            unsafe
            {
                switch (type)
                {
                    case FMOD.EVENT_CALLBACKTYPE.SOUNDDEF_CREATE :
                    {
                        int entryindex   = *(int*)param2.ToPointer() ;     // [in]  (int) index of sound definition entry
                        uint *realpointer = (uint *)param2.ToPointer();    // [out] (FMOD::Sound *) a valid lower level API FMOD Sound handle

                        FMOD.Sound s = null;
                        fsb.getSubSound(entryindex, ref s);

                        *realpointer = (uint)s.getRaw().ToPointer();

                        break;
                    }

                    case FMOD.EVENT_CALLBACKTYPE.SOUNDDEF_RELEASE :
                    {
                        break;
                    }
                }

            }
            return FMOD.RESULT.OK;
        }
 internal static unsafe IntPtr ConvertToNative(string strManaged, IntPtr pNativeBuffer)
 {
     byte num;
     byte* numPtr;
     if (strManaged == null)
     {
         return IntPtr.Zero;
     }
     System.StubHelpers.StubHelpers.CheckStringLength(strManaged.Length);
     bool flag = strManaged.TryGetTrailByte(out num);
     uint len = (uint) (strManaged.Length * 2);
     if (flag)
     {
         len++;
     }
     if (pNativeBuffer != IntPtr.Zero)
     {
         *((int*) pNativeBuffer.ToPointer()) = len;
         numPtr = (byte*) (pNativeBuffer.ToPointer() + 4);
     }
     else
     {
         numPtr = (byte*) Win32Native.SysAllocStringByteLen(null, len).ToPointer();
     }
     fixed (char* str = ((char*) strManaged))
     {
         char* chPtr = str;
         Buffer.memcpyimpl((byte*) chPtr, numPtr, (strManaged.Length + 1) * 2);
     }
     if (flag)
     {
         numPtr[len - 1] = num;
     }
     return (IntPtr) numPtr;
 }
 internal static unsafe IntPtr InterlockedExchangePointer(IntPtr lpAddress, IntPtr lpValue)
 {
     IntPtr ptr2;
     IntPtr ptr = *((IntPtr*) lpAddress.ToPointer());
     do
     {
         ptr2 = ptr;
         ptr = Interlocked.CompareExchange(ref (IntPtr) ref lpAddress.ToPointer(), lpValue, ptr2);
     }
     while (ptr != ptr2);
     return ptr;
 }
        static internal unsafe IntPtr InterlockedExchangePointer(
                IntPtr lpAddress,
                IntPtr lpValue)
        {
            IntPtr  previousPtr;
            IntPtr  actualPtr = *(IntPtr *)lpAddress.ToPointer();

            do {
                previousPtr = actualPtr;
                actualPtr   = Interlocked.CompareExchange(ref *(IntPtr *)lpAddress.ToPointer(), lpValue, previousPtr);
            }
            while (actualPtr != previousPtr);

            return actualPtr;
        }
 internal RioConnectionOrientedSocket(IntPtr overlapped, IntPtr adressBuffer, RioConnectionOrientedSocketPool pool, RioFixedBufferPool sendBufferPool, RioFixedBufferPool receiveBufferPool,
     uint maxOutstandingReceive, uint maxOutstandingSend, IntPtr SendCompletionQueue, IntPtr ReceiveCompletionQueue) :
     base(sendBufferPool, receiveBufferPool, maxOutstandingReceive, maxOutstandingSend, SendCompletionQueue, ReceiveCompletionQueue,
         ADDRESS_FAMILIES.AF_INET, SOCKET_TYPE.SOCK_STREAM, PROTOCOL.IPPROTO_TCP)
 {
     _overlapped = (RioNativeOverlapped*)overlapped.ToPointer();
     _eventHandle = Kernel32.CreateEvent(IntPtr.Zero, false, false, null);
     _adressBuffer = adressBuffer;
     _pool = pool;
     unsafe
     {
         var n = (NativeOverlapped*)overlapped.ToPointer();
         n->EventHandle = _eventHandle;
     }
 }
 protected override void RecognizeByte(uint lastVertexId, IntPtr pointer, OneIndexBuffer oneIndexBuffer, List<RecognizedPrimitiveInfo> primitiveInfoList, uint primitiveRestartIndex)
 {
     int length = oneIndexBuffer.Length;
     unsafe
     {
         var array = (byte*)pointer.ToPointer();
         long nearestRestartIndex = -1;
         uint i = 0;
         while (i < length && array[i] == primitiveRestartIndex)
         { nearestRestartIndex = i; i++; }
         for (i = i + 2; i < length; i++)
         {
             var value = array[i];
             if (value == primitiveRestartIndex)
             {
                 // try the loop back line.
                 nearestRestartIndex = i;
             }
             else if (value == lastVertexId
                 && array[i - 1] != primitiveRestartIndex
                 && array[nearestRestartIndex + 1] != primitiveRestartIndex
                 && nearestRestartIndex + 2 < i)
             {
                 var item = new RecognizedPrimitiveInfo(i, array[nearestRestartIndex + 1], array[i - 1], lastVertexId);
                 primitiveInfoList.Add(item);
             }
         }
     }
 }
        protected unsafe void CreateHistogram(IntPtr sourceData, int width, int height)
        {
            try
            {
                this.histogram.Reset();

                int points = 0;
                var pDepth = (ushort*)sourceData.ToPointer();
                for (int y = 0; y < height; ++y)
                {
                    for (int x = 0; x < width; ++x, ++pDepth)
                    {
                        ushort depthVal = *pDepth;
                        if (depthVal > 0)
                        {
                            this.histogram.Increase(depthVal);
                            points++;
                        }
                    }
                }
                this.histogram.PostProcess(points);
            }
            catch (AccessViolationException)
            { }
            catch (SEHException)
            { }
        }
示例#9
0
        public VertexBuffer(int vertexCapacity, int indexCapacity)
        {
            declarations = new List<VertexDeclaration>();

            int tmp;
            GL.GenVertexArrays(1, out tmp);
            VertexArrayObject = tmp;
            GL.BindVertexArray(VertexArrayObject);

            GL.GenBuffers(1, out tmp);
            VertexDataBufferObject = tmp;

            GL.GenBuffers(1, out tmp);
            IndexDataBufferObject = tmp;

            UsageMode = BufferUsageHint.DynamicDraw;

            vertexDataLength = vertexCapacity;
            indexDataLength = indexCapacity;

            _indexDataPointer = Marshal.AllocHGlobal(indexDataLength * sizeof(int));
            IndexData = (int*)_indexDataPointer.ToPointer();

            _vertexDataPointer = Marshal.AllocHGlobal(vertexDataLength * sizeof(float));
            VertexData = (float*)_vertexDataPointer.ToPointer();

            voffset = 0;
            ioffset = 0;
            stride = 0;
        }
示例#10
0
 public BloomFilter(IntPtr storage, long storageSize, IEnumerable<IHasher> hashes)
 {
     //TODO force Int32 alignment for storage
     _storageSize = storageSize - 1; //last int is used to hold count of writes
     _hashes = hashes.ToArray();
     _storage = (Int32*) storage.ToPointer();
 }
示例#11
0
        /// <summary>
        /// Readcallback
        /// </summary>
        /// <param name="dsp_state"></param>
        /// <param name="inbuf"></param>
        /// <param name="outbuf"></param>
        /// <param name="length"></param>
        /// <param name="inchannels"></param>
        /// <param name="outchannels"></param>
        /// <returns></returns>
        private static FMOD.RESULT READCALLBACK(ref FMOD.DSP_STATE dsp_state, IntPtr inbuf, IntPtr outbuf, uint length, int inchannels, int outchannels)
        {
            uint count = 0;
            int count2 = 0;
            IntPtr thisdspraw = dsp_state.instance;

            thisdsp.setRaw(thisdspraw);

            unsafe
            {
                float* inbuffer = (float*)inbuf.ToPointer();
                float* outbuffer = (float*)outbuf.ToPointer();

                for (count = 0; count < length; count++)
                {
                    for (count2 = 0; count2 < outchannels; count2++)
                    {
                        outbuffer[(count * outchannels) + count2] = inbuffer[(count * inchannels) + count2];
                    }
                    bpm.AddSample(inbuffer[(count * inchannels)] * 32767.0f);
                }
            }

            return FMOD.RESULT.OK;
        }
        protected override unsafe IList<Point> FindPointsWithinDepthRange(IntPtr dataPointer)
        {
            var result = new List<Point>();
            ushort* pDepth = (ushort*)dataPointer.ToPointer();

            int localHeight = this.Size.Height; //5ms faster when it's a local variable
            int localWidth = this.Size.Width;
            int maxY = localHeight - this.settings.LowerBorder;
            int minDepth = this.settings.MinimumDepthThreshold;
            int maxDepth = this.settings.MaximumDepthThreshold;

            for (int y = 0; y < localHeight; y++)
            {
                for (int x = 0; x < localWidth; x++)
                {
                    ushort depthValue = *pDepth;
                    if (depthValue > 0 && y < maxY && depthValue <= maxDepth && depthValue >= minDepth) //Should not be put in a seperate method for performance reasons
                    {
                        if (this.filterVolumes.Count == 0 || this.filterVolumes.Any(f => f.Contains(x, y, depthValue)))
                        {
                            result.Add(new Point(x, y, depthValue));
                        }
                    }
                    pDepth++;
                }
            }
            return result;
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="MemoryMappedTexture32bpp"/> class.
 /// </summary>
 /// <param name="size">The total size of the texture.</param>
 public MemoryMappedTexture32bpp(Size2 size)
 {
     m_pointer = Marshal.AllocHGlobal(size.Width * size.Height * 4);
     m_pointerNative = (int*)m_pointer.ToPointer();
     m_size = size;
     m_countInts = m_size.Width * m_size.Height;
 }
        /// <summary>
        /// 将YV12流转换成灰度二维矩阵
        /// </summary>
        /// <param name="pIn"></param>
        /// <param name="bytesOut"></param>
        /// <returns></returns>
        public static long DecodeYV12ToGreyBytes(IntPtr pIn, byte[,] bytesOut)
        {
            CheckOutput(bytesOut, "DecodeYV12ToGreyBytes");

            Stopwatch watch = Stopwatch.StartNew();

            unsafe
            {
                byte* yData = (byte*)pIn.ToPointer();
                lock (bytesOut)
                {
                    int W = bytesOut.GetLength(0);
                    int H = bytesOut.GetLength(1);
                    for (int h = 0; h < H; h++)
                    {
                        for (int w = 0; w < W; w++)
                        {
                            bytesOut[w, h] = yData[h * W + w];
                        }
                    }
                }
            }

            return watch.ElapsedMilliseconds;
        }
 internal unsafe PortAudio.PaStreamCallbackResult CallBack(IntPtr inputBuffer, IntPtr outputBuffer,
     uint framesPerBuffer, ref PortAudio.PaStreamCallbackTimeInfo timeInfo,
     PortAudio.PaStreamCallbackFlags statusFlags, IntPtr userData)
 {
     CallBack(framesPerBuffer, (float*)outputBuffer.ToPointer());
     return PortAudio.PaStreamCallbackResult.paContinue;
 }
示例#16
0
 public AprArray(IntPtr ptr, Type eltsType)
 {
     mArray = (apr_array_header_t *)ptr.ToPointer();
     mEltsType = null;
     if( eltsType != null )
         ElementType = eltsType;
 }
 public unsafe uint Write( IntPtr aBuf, uint aCount )
 {
     PreparePointer((int)aCount);
     Interop.MemCopy.Copy( aBuf.ToPointer(), CurrentPointer, ( int ) aCount );
     MovePointer(  aCount );
     return aCount;
 }
示例#18
0
        public static unsafe object ExtractValue(IntPtr pDbWriteSetting)
        {
            DBCONTACTWRITESETTING dbWriteSetting = *(DBCONTACTWRITESETTING*)pDbWriteSetting.ToPointer();

            switch ((DatabaseSettingType)dbWriteSetting.Value.Type)
            {
                case DatabaseSettingType.AsciiString:
                    return Marshal.PtrToStringAnsi(dbWriteSetting.Value.Text.TextPtr);
                case DatabaseSettingType.UnicodeString:
                case DatabaseSettingType.UTF8String:
                    return Marshal.PtrToStringUni(dbWriteSetting.Value.Text.TextPtr);
                case DatabaseSettingType.Byte:
                    return dbWriteSetting.Value.Primitives.Byte;
                case DatabaseSettingType.UInt16:
                    return dbWriteSetting.Value.Primitives.Word;
                case DatabaseSettingType.UInt32:
                    return dbWriteSetting.Value.Primitives.DWord;
                case DatabaseSettingType.Blob:
                    return Translate.ToBlob(dbWriteSetting.Value.Blob.BlobPtr, dbWriteSetting.Value.Blob.Size);
                case DatabaseSettingType.Deleted:
                    return null;
                default:
                    LogUnsupportedValue(dbWriteSetting);
                    return null;
            }
        }
示例#19
0
 protected override void RecognizeByte(uint lastVertexId, IntPtr pointer, OneIndexBufferPtr oneIndexBufferPtr, List<RecognizedPrimitiveIndex> lastIndexIdList, uint primitiveRestartIndex)
 {
     int length = oneIndexBufferPtr.Length;
     unsafe
     {
         var array = (byte*)pointer.ToPointer();
         long nearestRestartIndex = -1;
         uint i = 0;
         while (i < length && array[i] == primitiveRestartIndex)
         { nearestRestartIndex = i; i++; }
         for (i = i + 2; i < length; i++)
         {
             var value = array[i];
             if (value == primitiveRestartIndex)
             {
                 nearestRestartIndex = i;
             }
             else if (value == lastVertexId
                 && array[i - 1] != primitiveRestartIndex
                 && array[i - 2] != primitiveRestartIndex
                 && (i - nearestRestartIndex) % 3 == 0)
             {
                 var item = new RecognizedPrimitiveIndex(lastVertexId, i);
                 item.IndexIdList.Add(array[i - 2]);
                 item.IndexIdList.Add(array[i - 1]);
                 item.IndexIdList.Add(value);
                 lastIndexIdList.Add(item);
             }
         }
     }
 }
示例#20
0
 public static void DEV9readDMA8Mem(IntPtr memPointer, int size)
 {
     unsafe
     {
         Plugin.DEV9readDMA8Mem((byte*)memPointer.ToPointer(), size);
     }
 }
示例#21
0
		/// <summary>
		/// Inits internal pointer and move it to MIN(current position,<paramref name="length"/>)
		/// </summary>
		/// <param name="buffer"></param>
		/// <param name="length"></param>
		internal void Init(IntPtr buffer, int length)
		{
			_buffer = buffer;
			_length = length;
			_position =(uint) Math.Min( _position, _length );
			_currentPointer = ((byte*)_buffer.ToPointer()) + _position;
		}
 internal static unsafe Type GetTypeHelper(Type typeStart, Type[] genericArgs, IntPtr pModifiers, int cModifiers)
 {
     Type type = typeStart;
     if (genericArgs != null)
     {
         type = type.MakeGenericType(genericArgs);
     }
     if (cModifiers > 0)
     {
         int* numPtr = (int*) pModifiers.ToPointer();
         for (int i = 0; i < cModifiers; i++)
         {
             if (((byte) Marshal.ReadInt32((IntPtr) numPtr, i * 4)) == 15)
             {
                 type = type.MakePointerType();
             }
             else if (((byte) Marshal.ReadInt32((IntPtr) numPtr, i * 4)) == 0x10)
             {
                 type = type.MakeByRefType();
             }
             else if (((byte) Marshal.ReadInt32((IntPtr) numPtr, i * 4)) == 0x1d)
             {
                 type = type.MakeArrayType();
             }
             else
             {
                 type = type.MakeArrayType(Marshal.ReadInt32((IntPtr) numPtr, ++i * 4));
             }
         }
     }
     return type;
 }
        public unsafe void CreateImage(WriteableBitmap target, IntPtr pointer)
        {
            Int32Rect rectangle = default(Int32Rect);
            target.Dispatcher.Invoke(new Action(() => 
                {
                    rectangle = new Int32Rect(0, 0, target.PixelWidth, target.PixelHeight);
                }));

            byte* pImage = (byte*)pointer.ToPointer();

            var pixelCount = rectangle.Width * rectangle.Height;
            var buffer = new byte[pixelCount * 3];

            for (int index = 0; index < pixelCount; index++)
            {
                buffer[index * 3] = pImage[2];
                buffer[index * 3 + 1] = pImage[1];
                buffer[index * 3 + 2] = pImage[0];
                pImage += 3;
            }

            target.Dispatcher.Invoke(new Action(() =>
            {
                target.Lock();
                target.WritePixels(rectangle, buffer, rectangle.Width * 3, 0);
                target.Unlock();
            }));
        }
示例#24
0
        public unsafe SampleWindow()
        {
            int desiredWidth = 960, desiredHeight = 540;
            _nativeWindow = new NativeWindow(desiredWidth, desiredHeight, "ImGui.NET", GameWindowFlags.Default, OpenTK.Graphics.GraphicsMode.Default, DisplayDevice.Default);
            _scaleFactor = _nativeWindow.Width / desiredWidth;

            GraphicsContextFlags flags = GraphicsContextFlags.Default;
            _graphicsContext = new GraphicsContext(GraphicsMode.Default, _nativeWindow.WindowInfo, 3, 0, flags);
            _graphicsContext.MakeCurrent(_nativeWindow.WindowInfo);
            ((IGraphicsContextInternal)_graphicsContext).LoadAll(); // wtf is this?
            GL.ClearColor(Color.Black);
            _nativeWindow.Visible = true;
            _nativeWindow.X = _nativeWindow.X; // Work around OpenTK bug (?) on Ubuntu.

            _nativeWindow.KeyDown += OnKeyDown;
            _nativeWindow.KeyUp += OnKeyUp;
            _nativeWindow.KeyPress += OnKeyPress;

            ImGui.GetIO().FontAtlas.AddDefaultFont();

            SetOpenTKKeyMappings();

            _textInputBufferLength = 1024;
            _textInputBuffer = Marshal.AllocHGlobal(_textInputBufferLength);
            long* ptr = (long*)_textInputBuffer.ToPointer();
            for (int i = 0; i < 1024 / sizeof(long); i++)
            {
                ptr[i] = 0;
            }

            CreateDeviceObjects();
        }
示例#25
0
 protected override void RecognizeUInt(uint lastVertexId, IntPtr pointer, OneIndexBuffer oneIndexBuffer, List<RecognizedPrimitiveInfo> primitiveInfoList, uint primitiveRestartIndex)
 {
     int length = oneIndexBuffer.Length;
     unsafe
     {
         var array = (uint*)pointer.ToPointer();
         long nearestRestartIndex = -1;
         uint i = 0;
         while (i < length && array[i] == primitiveRestartIndex)
         { nearestRestartIndex = i; i++; }
         for (i = i + 1; i < length; i++)
         {
             var value = array[i];
             if (value == primitiveRestartIndex)
             {
                 nearestRestartIndex = i;
             }
             else if (value == lastVertexId
                 && array[i - 1] != primitiveRestartIndex
                 && (i - nearestRestartIndex) % 2 == 0)
             {
                 var item = new RecognizedPrimitiveInfo(i, array[i - 1], lastVertexId);
                 primitiveInfoList.Add(item);
             }
         }
     }
 }
        // Constructor
        public MumbleLink()
        {
            unsafe
            {
                _memSize = Marshal.SizeOf(typeof(MumbleLinkedMemory));

                _mappedFile = NativeMethods.OpenFileMapping(FileMapAccess.FileMapRead, false, Name);

                if (_mappedFile == IntPtr.Zero)
                {
                    _mappedFile = NativeMethods.CreateFileMapping(IntPtr.Zero, IntPtr.Zero, FileMapProtection.PageReadWrite, 0,
                        _memSize, Name);
                    if (_mappedFile == IntPtr.Zero)
                    {
                        throw new Exception("Unable to create file Mapping");
                    }
                }

                _mapView = NativeMethods.MapViewOfFile(_mappedFile, FileMapAccess.FileMapRead, 0, 0, _memSize);

                if (_mapView == IntPtr.Zero)
                {
                    throw new Exception("Unable to map view of file");
                }

                _buffer = new byte[_memSize];

                _bufferHandle = GCHandle.Alloc(_buffer, GCHandleType.Pinned);

                byte* p = (byte*)_mapView.ToPointer();

                _unmanagedStream = new UnmanagedMemoryStream(p, _memSize, _memSize, FileAccess.Read);

            }
        }
        /// <summary>
        /// Primitive patching. Inserts a jump to 'target' at 'site'. Works even if both methods'
        /// callers have already been compiled.
        /// </summary>
        /// <param name="site"></param>
        /// <param name="target"></param>
        public static RedirectCallsState PatchJumpTo(IntPtr site, IntPtr target)
        {
            RedirectCallsState state = new RedirectCallsState();

            // R11 is volatile.
            unsafe
            {
                byte* sitePtr = (byte*)site.ToPointer();
                state.a = *sitePtr;
                state.b = *(sitePtr + 1);
                state.c = *(sitePtr + 10);
                state.d = *(sitePtr + 11);
                state.e = *(sitePtr + 12);
                state.f = *((ulong*) (sitePtr + 2));

                *sitePtr = 0x49; // mov r11, target
                *(sitePtr + 1) = 0xBB;
                *((ulong*)(sitePtr + 2)) = (ulong)target.ToInt64();
                *(sitePtr + 10) = 0x41; // jmp r11
                *(sitePtr + 11) = 0xFF;
                *(sitePtr + 12) = 0xE3;
            }

            return state;
        }
示例#28
0
       unsafe public bool PosTest1()
        {
            bool retVal = true;
                  TestLibrary.TestFramework.BeginScenario("PosTest1: int*");
                  try
                  {  
                      int i = Int32.MaxValue;
                      IntPtr ptr1 = new IntPtr((void*)&i);
                      int* iAddress = (int*)ptr1.ToPointer();
                      if (iAddress != &i)
                      {
                          TestLibrary.TestFramework.LogError("001", "the address  is not equal to the i ");
                      }



                     
                          
                  }
                  catch(Exception e)
                  {
                      TestLibrary.TestFramework.LogError("002", "Unexpected exception: " + e);
                     retVal = false;

                  }
                  return retVal;
                               
              }
        /// <summary> buffer callback, COULD BE FROM FOREIGN THREAD. </summary>
        unsafe int ISampleGrabberCB.BufferCB(double SampleTime, IntPtr pBuffer, int BufferLen)
        {
            // Always call base.Prepare in the start!
            base.Prepare(pBuffer);

            byte* buffer = (byte*)pBuffer.ToPointer();
            int[,] rgbhistogram = calculateRGBHistogram(buffer);

            // Don't do this for the first frame
            if (base.m_count != 0)
            {
                int[] difference = calculateHistogramDifference(rgbhistogram, this.prevHistogram);

                if (difference[0] > this.treshold && difference[1] > this.treshold && difference[2] > this.treshold)
                {
                    base.shotDetected(pBuffer);
                }
            }

            this.prevHistogram = rgbhistogram;

            // Always call base.Finish in the end!
            base.Finish(pBuffer, BufferLen);

            return 0;
        }
示例#30
0
        /// <summary>
        /// Initializes a new instance of the <see cref="JavaVM" /> class.
        /// </summary>
        /// <param name="jvm">Pointer to the native JavaVM structure, returned from the native function JNI_CreateJavaVM.</param>
        public JavaVM(IntPtr jvm)
        {
            this.jvm = jvm;

            JNIInvokeInterface functions = *(*(JNIInvokeInterfacePtr*)jvm.ToPointer()).Functions;
            this.destroyJavaVM = (DestroyJavaVM)Marshal.GetDelegateForFunctionPointer(functions.DestroyJavaVM, typeof(DestroyJavaVM));
        }