Are you maybe accidentally defining cdCanvas twice or in two different modules?
On Wed, Jan 14, 2015 at 3:40 PM, J Luis <[email protected]> wrote: > BTW, if that matters, 'ctgc' is a global variable. > > quarta-feira, 14 de Janeiro de 2015 às 14:37:05 UTC, J Luis escreveu: > >> Hi, thanks for looking into this. >> >> If I make them show, as >> >> @show ctgc.iup_canvas >> ctgc.iup_canvas = t >> @show t >> @show ctgc.iup_canvas >> >> it 'shows' >> >> ctgc.iup_canvas => Ptr{cdCanvas} @0x0000000000000000 >> t => Ptr{cdCanvas} @0x0000000022c6d6c0 >> ctgc.iup_canvas => Ptr{cdCanvas} @0x0000000022c6d6c0 >> >> which shows that type has not changed after the attribution and that it >> has the correct return type of cdCreateCanvas(). >> That is why I initialized the ctgc type with >> >> convert(Ptr{cdCanvas},0) >> >> (see first member in my first post) >> >> >> quarta-feira, 14 de Janeiro de 2015 às 13:39:21 UTC, Milan Bouchet-Valat >> escreveu: >>> >>> Le mercredi 14 janvier 2015 à 05:32 -0800, J Luis a écrit : >>> > Hi, >>> > I have had quite some head-aches with types (converted from C structs) >>> > but this one wins. >>> > >>> > I have this type (from IUP) >>> > >>> > >>> > type tCTC >>> > iup_canvas::Ptr{cdCanvas} >>> > w::Cint >>> > h::Cint >>> > ... >>> > >>> > which I initialize as >>> > >>> > ctgc = tCTC( >>> > convert(Ptr{cdCanvas},0), >>> > int32(0), int32(0), >>> > ... >>> > >>> > and now the mystery. >>> > >>> > t = cdCreateCanvas(cdContextIup(), IupGetHandle("cnvMain")) >>> > ctgc.iup_canvas = t >>> > cdActivate(t); >>> > cdActivate(ctgc.iup_canvas); >>> > >>> > >>> > the last line in the chunk above errors with >>> > >>> > >>> > ERROR: `cdActivate` has no method matching cdActivate(::Ptr{cdCanvas}) >>> > in CDTestInit at C:\programs\Gits\IUP.jl\examples\cdtest_.jl:125 >>> > in cdtest at C:\programs\Gits\IUP.jl\examples\cdtest_.jl:92 >>> > >>> > >>> > So `t` and `ctgc.iup_canvas` are actually two different entities >>> > (although their pointers are ofc the same as I can see if I @show >>> > them)? >>> Well, you need to show us more details, e.g. tell us what >>> cdCreateCanvas() does, and what type it returns. The pointers might hold >>> the same address, but they still may be of different types. @show should >>> make this visible, but without the output we cannot check. >>> >>> >>> Regards >>> >>>
