It's not a hack I don't know where it is documented but for this code: proc setDash*(cr: Context, dashes: openarray[float64], offset: float64) {.importc: "cairo_set_dash".} var dashes = @[ 50.0, # ink 10.0, # skip 10.0, # ink 10.0 # skip ] offset = -50.0 ctx.setDash(dashes, offset) Run
compiler turns it into: dl(ctx, dashes.p->data, dashes.len, offset); Run Also works correctly when dashes is an array. so for me it's the safest choice.