> But some callbacks have additional parameters! And in C example code for the > library they just cast the different callback signatures with (Icallback).
In this case you have no other choice then to use cast to call the C functions and it's completly justified. I don't know much about iup, though you could try something like that to make it safer: proc setCallbackClick(ih: PtrIHandle, handler: proc (arg: PtrIhandle, mousebutton: cint): cint {.cdecl.}) = ih.setCallback("CLICK", cast[Icallback](handler)) Run