www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Derelict GLFW3 glfw3.dll error

reply Alexander <awpatapoff gmail.com> writes:
import std.stdio;

import derelict.opengl3.gl3;
import derelict.glfw3.glfw3;
pragma(lib, 
"C:\\Users\\Alexander\\AppData\\Roaming\\dub\\packages\\derelict-gl3-1.0.17\\lib\\DerelictGL3");
pragma(lib, 
"C:\\Users\\Alexander\\AppData\\Roaming\\dub\\packages\\derelict-glfw3-master\\lib\\DerelictGLFW3");
pragma(lib, 
"C:\\Users\\Alexander\\AppData\\Roaming\\dub\\packages\\derelict-util-2.0.4\\lib\\DerelictUtil");
pragma(lib,"lb");

int main()
{
	DerelictGL3.load();
	DerelictGLFW3.load();
     GLFWwindow* window;


     if (!glfwInit())
         return -1;


     window = glfwCreateWindow(640, 480, "Hello World", null, 
null);
     if (!window)
     {
         glfwTerminate();
         return -1;
     }

     /* Make the window's context current */
     glfwMakeContextCurrent(window);
	DerelictGL3.reload();


     while (!glfwWindowShouldClose(window))
     {



         glfwSwapBuffers(window);


         glfwPollEvents();
     }

     glfwTerminate();
     return 0;
}


ERROR: 
"derelict.util.exception.SharedLibLoadException ..\..\AppData\Roaming\dub\packages\derelict-util-2.0.4\source\derelict\u
il\exception.d(35): Failed to load one or more shared libraries:
	glfw3.dll - The specified module could not be found."

Is there a way for me to link the glfw.dll so that derelictUtil 
can find the dll? Or am I going about this wrong?
Nov 27 2015
next sibling parent Mike Parker <aldacron gmail.com> writes:
On Friday, 27 November 2015 at 22:58:20 UTC, Alexander wrote:

 ERROR: 
 "derelict.util.exception.SharedLibLoadException ..\..\AppData\Roaming\dub\packages\derelict-util-2.0.4\source\derelict\u
il\exception.d(35): Failed to load one or more shared libraries:
 	glfw3.dll - The specified module could not be found."

 Is there a way for me to link the glfw.dll so that derelictUtil 
 can find the dll? Or am I going about this wrong?
No, none of the Derelict packages have a link-time dependency the libraries they bind. It's purely a runtime dependency. You need to make sure that the DLL is somewhere it can be found. GLFW3 is not a system library, so that generally means you need to make sure it is in the same directory as your executable.
Nov 27 2015
prev sibling parent Mike Parker <aldacron gmail.com> writes:
On Friday, 27 November 2015 at 22:58:20 UTC, Alexander wrote:
 import std.stdio;

 import derelict.opengl3.gl3;
 import derelict.glfw3.glfw3;
 pragma(lib, 
 "C:\\Users\\Alexander\\AppData\\Roaming\\dub\\packages\\derelict-gl3-1.0.17\\lib\\DerelictGL3");
 pragma(lib, 
 "C:\\Users\\Alexander\\AppData\\Roaming\\dub\\packages\\derelict-glfw3-master\\lib\\DerelictGLFW3");
 pragma(lib, 
 "C:\\Users\\Alexander\\AppData\\Roaming\\dub\\packages\\derelict-util-2.0.4\\lib\\DerelictUtil");
 pragma(lib,"lb");
I should also point out that if you're using DUB to build your project, you do not need these pragmas. DUB will manage all of this for you.
Nov 27 2015