So write it as: proc f(g: proc (x: cint): cint {.cdecl.}, x: cint): cint {.importc.} echo f( proc (x: cint): cint {.cdecl.} = x + 1, 1) Run
It's hardly any longer for your example.
So write it as: proc f(g: proc (x: cint): cint {.cdecl.}, x: cint): cint {.importc.} echo f( proc (x: cint): cint {.cdecl.} = x + 1, 1) Run
It's hardly any longer for your example.