Help on passing a function to a function pointer.

Paul Backus snarwin at gmail.com
Wed Mar 24 03:06:15 UTC 2021


On Wednesday, 24 March 2021 at 02:41:39 UTC, Kirill wrote:
> DMD produces the following error:
> `source/display.d(59,32): Error: function pointer 
> glfwSetFramebufferSizeCallback(GLFWwindow*, extern (C) void 
> function(GLFWwindow*, int, int) nothrow)
> is not callable using argument types
> (GLFWwindow*, extern (C) void delegate(GLFWwindow* window, int 
> w, int h) nothrow)

You're trying to pass a pointer to a member function (a 
"delegate"), but it expects a pointer to a non-member function. 
Either make the function `static` or move it outside the 
class/struct it's currently in.


More information about the Digitalmars-d mailing list