예제 #1
0
        public IntPtr LoadSymbol(IntPtr library, string symbolName)
        {
            try
            {
                return(_underlyingLoader.LoadSymbol(library, symbolName));
            }
            catch (SymbolLoadingException)
            {
                IntPtr ret;
                try
                {
                    ret = GlfwProvider.GLFW.Value.GetProcAddress(symbolName);
                }
                catch (GlfwException ex)
                {
                    if (ex.ErrorCode == ErrorCode.NoContext)
                    {
                        // give a more helpful error message
                        throw new InvalidOperationException
                              (
                                  "An OpenGL context isn't current on this thread. If you're using Silk.NET.Windowing, you" +
                                  "can access the render thread via the Invoke method on IWindow.",
                                  ex
                              );
                    }

                    throw;
                }

                if (ret == IntPtr.Zero)
                {
                    throw new SymbolLoadingException
                          (
                              $"GLFW: \"{symbolName}\" not found."
                          );
                }

                return(ret);
            }
        }
 /// <summary>
 /// Forwards the symbol loading call to the wrapped platform loader.
 /// </summary>
 /// <param name="sym">The symbol name.</param>
 /// <returns>A handle to the symbol.</returns>
 internal IntPtr LoadSymbol([NotNull] string sym) => _symbolLoader.LoadSymbol(_libraryHandle, sym);
예제 #3
0
        public IntPtr LoadSymbol(IntPtr library, [NotNull] string symbolName)
        {
            LoadSymbolCalled = true;

            return(_defaultLoader.LoadSymbol(library, symbolName == "GetString" ? "GetNullString" : symbolName));
        }