@doofenstein Right, I forgot the {.cdecl.}, good catch.
The reason why the cast is there, is that the iup library has only one function to set the callbacks, which in `Nim` is: # Callback definition Icallback* = proc (arg: PtrIhandle): cint {.cdecl.} # Function for setting a callback proc setCallback*(ih: PtrIhandle, name: cstring, fn: Icallback): Icallback {.importc: "IupSetCallback", cdecl, discardable.}` Run and in `C` it's: // Callback definition typedef int (*Icallback)(Ihandle*); // Function for setting a callback Icallback IupSetCallback(Ihandle* ih, const char *name, Icallback func); Run Which works great for callbacks that have the exact same signature as Icallback. But some callbacks have additional parameters! And in `C` example code for the library they just cast the different callback signatures with `(Icallback)`. Example from the IUP official docs: // Functions int btn_on_off_cb(Ihandle *self) { // code } int btn_image_button_cb( Ihandle *self,int b, int e ) { // code } // Setting up the callbacks IupSetCallback( btn_on_off, "ACTION", (Icallback) btn_on_off_cb ); IupSetCallback( btn_image, "ACTION", (Icallback) btn_image_button_cb ); Run So I'm just doing the same as these examples in `C`, because I don't know of a way to do this better in `Nim`. Any suggestions would be greatly appreciated?