When calling DerelictGL3.reload() after making a context for OpenGL, my application crashes when built in release mode. In debug mode it works just fine.
Example code: (glfw3.dll was taken from the 'lib-vc2015' folder and included in the same directory)
import derelict.glfw3.glfw3;
import derelict.opengl;
/+
dub.json:
{
"name": "derelictGLissue",
"dependencies": {
"derelict-glfw3": "~>4.0.0-beta.1",
"derelict-gl3": "~>2.0.0-beta.4",
},
}
+/
int main() {
DerelictGL3.load();
DerelictGLFW3.load("glfw3.dll");
if (!glfwInit())
{
glfwTerminate();
}
glfwWindowHint(GLFW_SAMPLES, 4);
glfwWindowHint(GLFW_RESIZABLE, GL_TRUE);
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2);
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
GLFWwindow* window = glfwCreateWindow(1280, 720, "Title", null, null);
if (!window)
{
glfwTerminate();
throw new Exception("Failed to create window");
}
glfwMakeContextCurrent(window);
DerelictGL3.reload();
while (!glfwWindowShouldClose(window))
{
glViewport(0, 0, 1280, 720);
glClearColor(0.2f, 0.8f, 0.8f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glfwSwapBuffers(window);
glfwPollEvents();
}
glfwDestroyWindow(window);
glfwTerminate();
return 0;
}
Running dub run succesfully shows a window, while running dub run --build=release results in an acces violation:
object.Error@(0): Access Violation
----------------
0x0042D613
0x00410944
0x00402A5D
Program exited with code 1
When calling DerelictGL3.reload() after making a context for OpenGL, my application crashes when built in release mode. In debug mode it works just fine.
Example code: (glfw3.dll was taken from the 'lib-vc2015' folder and included in the same directory)
Running
dub runsuccesfully shows a window, while runningdub run --build=releaseresults in an acces violation: