Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 6 of 6

Thread: OpenGL.dll and LoadLibrary

  1. #1
    Guest

    OpenGL.dll and LoadLibrary

    When I call LoadLibrary with "opengl.dll" as parameter, it always returns error code 1114 => Initialization of the opengl.dll failed.

    What can I do to load the dll with LoadLibrary correctly?

  2. #2
    Junior Member Regular Contributor
    Join Date
    Dec 2000
    Location
    Almazora, Spain
    Posts
    104

    Re: OpenGL.dll and LoadLibrary

    Firstly, the name of the DLL is not opengl.dll, but opengl32.dll.
    Secondly, why do you use LoadLibrary? your program will load it automatically, if it uses an OpenGL function, uses the opengl32.lib and is located at:
    c:\windows
    c:\windows\system
    or the directory of your executable.
    MeTaL WiLL NeVeR DiE!!!!!

  3. #3
    Junior Member Regular Contributor
    Join Date
    Dec 2000
    Location
    Damascus, Syria
    Posts
    147

    Re: OpenGL.dll and LoadLibrary

    Which language do you use? C/C++ or Delphi?

  4. #4
    Guest

    Re: OpenGL.dll and LoadLibrary

    I use C++...

    I wanna use LoadLibary to make a proxy dll.

  5. #5
    Junior Member Regular Contributor
    Join Date
    Dec 2000
    Location
    Damascus, Syria
    Posts
    147

    Re: OpenGL.dll and LoadLibrary

    I don't know what do you mean by proxy dll, but since you use C++, I don't think you need to use LoadLibrary, because you can add include directives to automatically use the OpenGL library:

    #include "gl/gl.h"
    #include "gl/glu.h"
    #include "gl/glaux.h"

    However if you insist, you can write:

    HINSTANCE Handle = LoadLibrary("opengl32.dll");

    Then, to find the entry address of every function you must use the function GetProcAddress, and pass to it the handle you got and the name of the procedure. This way you'll get a CALLBACK function that you can use. I can't help you with CALLBACK functions because I am a Delphi programmer and we have Procedural types instead of CALLBACK functions which differ in declaration.

    GA

  6. #6
    Guest

    Re: OpenGL.dll and LoadLibrary

    "Explicit" linking (using LoadLibrary()) has advantages over "implicit" linking (linking with the stub library):

    1> It makes it so that the client of the library doesn't die with an ugly messagebox at launch in the case the library is unavailable.

    2> It doesn't load libraries it does not need, wasting computer resources. For instance, an engine which supports both D3D and OpenGL benefits from explicit linking because it only needs toload one or the other library at run time. With implicit linking, both libraries get loaded, taking more time and memory.

    There's a section in the MSVC docs about the advantages and disadvantages of each which delves into more detail.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •