Using OpenGL
Lodovico Giaretta via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sat Sep 3 04:13:30 PDT 2016
On Saturday, 3 September 2016 at 11:10:00 UTC, Darren wrote:
> On Saturday, 3 September 2016 at 11:02:11 UTC, Lodovico
> Giaretta wrote:
>>>//glfwSetKeyCallback(window, key_callback);
>>
>> glfwSetKeyCallback(window, &key_callback);
>
> I actually tried this before but it doesn't work. I get the
> following error:
>
> Error: function pointer glfwSetKeyCallback (GLFWwindow*, extern
> (C) void function(GLFWwindow*, int, int, int, int) nothrow) is
> not callable using argument types (GLFWwindow*, void
> function(GLFWwindow* window, int key, int scancode, int action,
> int mode))
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.
More information about the Digitalmars-d-learn
mailing list