Should dmd have given me a warning at least?
Ali Çehreli via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Fri Sep 12 15:53:34 PDT 2014
On 09/12/2014 03:44 PM, WhatMeWorry wrote:
>
> // the following two lines compile cleanly but when executed, I get
> // D:\Projects\Derelict>02_SimpleOpenGL_3_3_program.exe
> // object.Error: Access Violation
> // ----------------
>
> string glShadingLangVer =
> to!string(glGetString(GL_SHADING_LANGUAGE_VERSION));
According to the documentation, you are supposed to make sure that
glGetString does not return 0:
https://www.opengl.org/sdk/docs/man2/xhtml/glGetString.xml
(See Notes and Errors there.)
> writeln("glShadingLangVer is ", glShadingLangVer);
>
>
>
>
> glGetString has the following signature:
>
> const GLubyte* glGetString(GLenum name);
>
> I presume the const is causing the problem.
No, const would have caused a compilation error. Access Violation is a
runtime error caused by invalid memory access location like 0. ;)
Ali
More information about the Digitalmars-d-learn
mailing list