I searched the manual. Did not find an example.
So first here is the code i'm working with in the glfw3 Wrapper
type
KeyFun* = proc (window: Window; key: cint; scancode: cint; action: cint; modifiers: cint) {.cdecl.}
and the code i'm trying to implement in my program
proc SetKeyCallback*(window: Window; cbfun: KeyFun): KeyFun {.cdecl, importc: "glfwSetKeyCallback", dynlib: GlfwLib.}
i can call the setkeycallback proc fine but how do i get the cbfun var in the setkeycallback proc to work?
i tried the c method of just putting the proc name for a var into the callback proc. But i get a type mismatch error it expects KeyFun in the setKeycallback proc
so i'm stumped...
Read this and annotate the proc you want to pass with .cdecl too: