In Nim you can define procs with same name but different parameter list, so
this compiles:
type
Fl_Widget = int
Fl_Callback = int
proc setCallback*(wgt: ptr Fl_Widget; cb: ptr Fl_Callback;
pdata: pointer = nil; num: cint = 1): cint =
discard
proc setCallback*(wgt: ptr Fl_Widget; cb: ptr Fl_Callback;
pdata: int = 0; num: cint = 1): cint =
var hhh: pointer = cast[pointer](pdata)
#setCallback(wgt, cb, pointer(pdata), num)
setCallback(wgt, cb, hhh, num)
var wgt: ptr Fl_Widget
var cb: ptr Fl_Callback
discard setCallback(wgt, cb, nil, 2)
discard setCallback(wgt, cb, 0, 2)
Run
The problem in this case may be that size of cint is not equal to size of
pointer. You may use int as parameter type, as size of int is size of pointer
in Nim. Direct type conversion with pointer(mycint) seems not to work, so I
used a cast with additional variable. You may test it, maybe you have to use a
when statement to decide if size(cint) is smaller than size(pointer) and
execute different code. Note that your topmost "C" code seems to be C++, as C
generally has no defaults for parameters.