May the compiler already know the reason for the problem? Because compiler
refuses to do a direct cast. Cast with intermediate pointer variable works, and
that is what is used in the cairo bindings. So the compiler may have its reason
to refuse the direct cast, but it does not tell us its reason.
type
Surface00* {.pure.} = object
Surface* = ref object
impl*: ptr Surface00
ignoreFinalizer*: bool
when isMainModule:
proc test =
var surf = Surface()
GC_ref(surf)
GC_unref(cast[RootRef](surf)) # Error: expression cannot be cast to
RootRef=ref RootObj
var p: pointer = cast[pointer](surf)
#GC_unref(cast[RootRef](p)) # compiles
test()
Run
- Does parameter type matter for GC_unref()? Stefan_Salewski
- Does parameter type matter for GC_unref()? Stefan_Salewski
- Does parameter type matter for GC_unref()? Stefan_Salewski
- Does parameter type matter for GC_unref()? planetis
- Does parameter type matter for GC_unref()... Araq
- Does parameter type matter for GC_un... Stefan_Salewski
- Does parameter type matter for G... Araq
- Does parameter type matter f... Stefan_Salewski
- Does parameter type matter f... Araq
- Does parameter type matter f... Stefan_Salewski
- Does parameter type matter f... Stefan_Salewski
- Does parameter type matter f... Stefan_Salewski
- Does parameter type matter f... Araq
