On Saturday, 3 September 2016 at 11:13:30 UTC, Lodovico Giaretta wrote:

Ah! Well, providing error messages is always useful. Now I see your issue: your callback has D linkage, but OpenGL expects a function with C linkage. So you have to put `extern(C)` on your callback declaration.

Well, it's GLFW, not OpenGL, but yes they do need to be extern (C) and also nothrow, as that is how the callback types are declared in Derrlict:

```
extern(C) nothrow
void key_callback(GLFWwindow* window, int key, int scancode, int action, int mode) {
    if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS)
        glfwSetWindowShouldClose(window, GL_TRUE);
}
```
  • Using OpenGL Darren via Digitalmars-d-learn
    • Re: Using OpenGL Mike Parker via Digitalmars-d-learn
      • Re: Using OpenGL Darren via Digitalmars-d-learn
        • Re: Using OpenGL pineapple via Digitalmars-d-learn
          • Re: Using OpenG... Darren via Digitalmars-d-learn
            • Re: Using ... Lodovico Giaretta via Digitalmars-d-learn
              • Re: Us... Darren via Digitalmars-d-learn
                • Re... Lodovico Giaretta via Digitalmars-d-learn
                • Re... Mike Parker via Digitalmars-d-learn
                • Re... Darren via Digitalmars-d-learn
              • Re: Us... Mike Parker via Digitalmars-d-learn
                • Re... Darren via Digitalmars-d-learn
                • Re... Mike Parker via Digitalmars-d-learn
                • Re... Mike Parker via Digitalmars-d-learn
                • Re... Darren via Digitalmars-d-learn
                • Re... Nicholas Wilson via Digitalmars-d-learn
                • Re... Guillaume Piolat via Digitalmars-d-learn
                • Re... Darren via Digitalmars-d-learn
                • Re... Mike Parker via Digitalmars-d-learn

Reply via email to