proc write*(bq : PBlockQueue, fmtstr : cstring) : void {.cdecl,
importc: "bqueue_write", varargs.}
The problem seems to be that the varargs isn't actually treated as anything in the Nimrod end of things. When I try to wrap this function with some extra functionality on the Nimrod side, like this:
template write*(d : var TDisplay, node : int, args : varargs[expr]) =
d.address(node)
d.pipe.write(args)
I get told off by the compiler:
display.nim(51, 9) Error: type mismatch: got (PBlockQueue, varargs[expr])
but expected one of:
bqueue.write(bq: PBlockQueue, fmtstr: cstring)
Which is the function I want to call, but I see no way to match it with my varargs since they are not formally part of the signature, it seems.
template write*(d : var TDisplay, node : int, fmtstr: cstring, args : varargs[expr]) =
d.address(node)
d.pipe.write(fmtstr, args)
This works for me. Just 3rd argument missed.
Error: internal error: getTypeDescAux(tyExpr)
No stack traceback available
Odd. It seems the compiler is unable to find a type name for my 'exprs': https://github.com/Araq/Nimrod/blob/2fc928688eab6ad389ae1fce87230f1ecba69106/compiler/ccgtypes.nim#L613
cgen.nim(1289) myProcess
ccgstmts.nim(995) genStmts
ccgexprs.nim(1902) expr
ccgstmts.nim(995) genStmts
ccgexprs.nim(1966) expr
cgen.nim(880) genProc
cgen.nim(850) genProcNoForward
cgen.nim(784) genProcAux
ccgstmts.nim(995) genStmts
ccgexprs.nim(1902) expr
ccgstmts.nim(995) genStmts
ccgexprs.nim(1902) expr
ccgstmts.nim(995) genStmts
ccgexprs.nim(1902) expr
ccgstmts.nim(995) genStmts
ccgexprs.nim(1858) expr
ccgcalls.nim(294) genCall
ccgcalls.nim(138) genPrefixCall
ccgcalls.nim(118) genArgNoParam
cgen.nim(586) initLocExpr
ccgexprs.nim(1876) expr
ccgexprs.nim(1713) genArrayConstr
cgen.nim(406) getTemp
ccgtypes.nim(620) getTypeDesc
ccgtypes.nim(585) getTypeDescAux
ccgtypes.nim(613) getTypeDescAux
msgs.nim(826) internalError
msgs.nim(764) rawMessage
msgs.nim(761) rawMessage
msgs.nim(714) handleError