CSharpGL.Win32.GetProcAddress C# (CSharp) Метод

GetProcAddress() приватный Метод

private GetProcAddress ( IntPtr lib, String funcName ) : IntPtr
lib IntPtr
funcName String
Результат IntPtr
        internal static extern IntPtr GetProcAddress(IntPtr lib, String funcName);

Same methods

Win32::GetProcAddress ( string name ) : IntPtr

Usage Example

Пример #1
0
        private static T GetDelegateFor <T>() where T : class
        {
            //  Get the type of the extension function.
            Type delegateType = typeof(T);

            //  Get the name of the extension function.
            string name = delegateType.Name;

            // ftlPhysicsGuy - Better way
            Delegate del = null;

            if (!extensionFunctions.TryGetValue(name, out del))
            {
                // check https://www.opengl.org/wiki/Load_OpenGL_Functions
                IntPtr proc    = Win32.wglGetProcAddress(name);
                int    pointer = proc.ToInt32();
                if (-1 <= pointer && pointer <= 3)
                {
                    proc    = Win32.GetProcAddress(name);
                    pointer = proc.ToInt32();
                    if (-1 <= pointer && pointer <= 3)
                    {
                        throw new Exception("Extension function " + name + " not supported");
                    }
                }

                //  Get the delegate for the function pointer.
                del = Marshal.GetDelegateForFunctionPointer(proc, delegateType);

                //  Add to the dictionary.
                extensionFunctions.Add(name, del);
            }

            return(del as T);
        }
All Usage Examples Of CSharpGL.Win32::GetProcAddress