What I found is if, for simplification, I restrict the type to (that is 
without type assignment)

type tCTC_l
    iup_canvas
end

than it works. But if I change it to

type tCTC_l
    iup_canvas::Ptr{cdCanvas}
end

it errors again. For curiosity I tried also

type tCTC_l
    iup_canvas::Int64
end

and now

t => Ptr{cdCanvas} @0x0000000021c3f4a0
ctgc_l.iup_canvas => 566490272
ERROR: `cdActivate` has no method matching cdActivate(::Int64)

that is, it converted the Ptr{cdCanvas} (the 't') to Int64, so it seams 
that in the first instance it converted one Ptr{cdCanvas} to another 
Ptr{cdCanvas} ending up with TWO declarations of the Ptr{cdCanvas}.
Does it make any sense?


quarta-feira, 14 de Janeiro de 2015 às 17:50:51 UTC, J Luis escreveu:
>
> Yes, an synthetic example would be nice, but I strongly suspect that if I 
> was able to create one than it would because I had found the problem.
>
> quarta-feira, 14 de Janeiro de 2015 às 16:15:20 UTC, Milan Bouchet-Valat 
> escreveu:
>>
>> Le mercredi 14 janvier 2015 à 07:42 -0800, J Luis a écrit : 
>> > Well, I can make the current (failing) code available in the IUP repo 
>> > but to run it implies installing the IUP lib, and IUP.jl which 
>> > probably no one tested in other than Windows. 
>> But the problem does not seem to involve IUP (or via a nasty memory 
>> corruption bug). You should be able to reproduce it with a short 
>> artificial example. 
>>
>>
>> Regards 
>>
>> > quarta-feira, 14 de Janeiro de 2015 às 15:30:20 UTC, Milan 
>> Bouchet-Valat escreveu: 
>> >         Le mercredi 14 janvier 2015 à 06:54 -0800, J Luis a écrit : 
>> >         > I already fall in those two forms of troubles (double 
>> definition and 
>> >         > double inclusion of the file where the type is defined) so 
>> I'm aware 
>> >         > of it. As much as I can tell with grepping, that is not 
>> occurring 
>> >         > now. 
>> >         > Maybe a third (unknown to me) form of this type of issue? 
>> >         Would you be able to create a reproducible example? 
>> >         
>> >         
>> >         Regards 
>> >         
>> >         > quarta-feira, 14 de Janeiro de 2015 às 14:41:56 UTC, Keno 
>> Fischer 
>> >         > escreveu: 
>> >         >         Are you maybe accidentally defining cdCanvas twice or 
>> in two 
>> >         >         different modules? 
>> >         >         
>> >         >         On Wed, Jan 14, 2015 at 3:40 PM, J Luis <
>> jmf...@gmail.com> 
>> >         >         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 
>> >         >                                 
>> >         >         
>> >         >         
>> >         
>>
>>

Reply via email to