将C风格回调设置函数绑定到D

将C风格回调设置函数绑定到D,c,callback,d,glfw,C,Callback,D,Glfw,我目前正在绑定GLFW3库(出于各种原因,我没有使用Derelict)。这是很容易做到的,除了以下几点之外,没有任何实际问题: extern (C) { alias void(*GLFWwindowposfun)(GLFWwindow*, int, int); alias void(*GLFWwindowsizefun)(GLFWwindow*, int, int); alias void(*GLFWwindowclosefun)(GLFWwindow*); al

我目前正在绑定GLFW3库(出于各种原因,我没有使用Derelict)。这是很容易做到的,除了以下几点之外,没有任何实际问题:

extern (C) {
    alias void(*GLFWwindowposfun)(GLFWwindow*, int, int);
    alias void(*GLFWwindowsizefun)(GLFWwindow*, int, int);
    alias void(*GLFWwindowclosefun)(GLFWwindow*);
    alias void(*GLFWwindowrefreshfun)(GLFWwindow*);
    alias void(*GLFWwindowfocusfun)(GLFWwindow*, int);
    alias void(*GLFWwindowiconifyfun)(GLFWwindow*, int);
    alias void(*GLFWframebuffersizefun)(GLFWwindow*, int, int);
}
以下是如何定义一个原始声明(在GLFW/GLFW3.h中):

typedef void (* GLFWwindowposfun)(GLFWwindow*,int,int);
从编译的意义上讲,这已经足够好了,但是,它确实会触发以下警告:

Source/MageLib/GLFW3.di(9): Deprecation: C-style function pointer and pointer to array syntax is deprecated. Use 'function' to declare function pointers
Source/MageLib/GLFW3.di(10): Deprecation: C-style function pointer and pointer to array syntax is deprecated. Use 'function' to declare function pointers
Source/MageLib/GLFW3.di(11): Deprecation: C-style function pointer and pointer to array syntax is deprecated. Use 'function' to declare function pointers
Source/MageLib/GLFW3.di(12): Deprecation: C-style function pointer and pointer to array syntax is deprecated. Use 'function' to declare function pointers
Source/MageLib/GLFW3.di(13): Deprecation: C-style function pointer and pointer to array syntax is deprecated. Use 'function' to declare function pointers
Source/MageLib/GLFW3.di(14): Deprecation: C-style function pointer and pointer to array syntax is deprecated. Use 'function' to declare function pointers
Source/MageLib/GLFW3.di(15): Deprecation: C-style function pointer and pointer to array syntax is deprecated. Use 'function' to declare function pointers
通过谷歌搜索,我获得了以下资源:

但我不知道如何应用,我尝试过这样做,但显然不起作用:

alias void function(GLFWwindow*, int, int);
这会产生以下错误:

Source/MageLib/GLFW3.di(9): Error: no identifier for declarator extern (C) void function(GLFWwindow*, int, int)

如何正确地转换此函数?

别名GLFWwindowposfun=void函数(GLFWwindow*,int,int)

啊!!我想应该是这样的,我忘了回拨是d区的头等公民。谢谢。