> I looked up the c definition of this function…
>
> The list is supposed to be a null-terminated list of (name, function) 
> argument pairs. I think you can just go with the following for now though:
>
> function IupSetCallbacks(ih::Ptr{Ihandle}, name::String, func1::Icallback)
>     ccall((:IupSetCallbacks, iup), Icallback, (Ptr{Ihandle}, Ptr{Uint8}, 
> Icallback, Ptr{Void}...), ih, name, func1, C_NULL)
> end
>
> Thanks. I remember that I had other functions using varargs so I assume 
that I should do similar for those other functions
 

> Unfortunately (or fortunately), I couldn’t see anything else wrong with 
> your code.
>
> Is the IUP.IupCanvas() call essential, or does just calling gc() there 
> also crash julia?
>
Good catch. Yes `gc()` alone can crash it. 
That's all it takes to do it

julia> using IUP_CD

julia> gc()


Since I don’t see anywhere that you needed to access the fields directly, I 
> suspect you should just declare this type as a typealias to Void. (or 
> perhaps just a thin wrapper type around Ptr{Void}, so that you can add a 
> gc-finalizer, ala 
> https://github.com/stevengj/PyCall.jl/blob/9db730b528d7abb53444f3f89b434bd72a38cc8d/src/PyCall.jl#L82-L90
> )
>
I'm afraid I only half-understand this. The IupCanvas C signature says 
 
Ihandle* IupCanvas(const char **action*);

*action*: Name of the action generated when the canvas needs to be 
redrawn. It can be NULL.

*Returns:* the identifier of the created element, or NULL if an error 
occurs.


so, though not used in any of the examples I ported from the IUP C 
examples, it's supposed to be possible to use with one input argument

>
> It looks like `cdCanvas` might be quite large. Perhaps this is hitting 
> some conflict in the gc?
>
>
> ----
>
> # I Don't understand the purpose of this function, which true definition 
> includes a varargs, so I implemented
> # this one only as a guide for the future problems
> function IupSetCallbacks(ih::Ptr{Ihandle}, name::String, func1::Icallback, 
> func2::Icallback)
> ccall((:IupSetCallbacks, iup), Icallback, (Ptr{Ihandle}, Ptr{Uint8}, 
> Icallback, Icallback), ih, name, func1, func2)
> end
>
> note that defining a varargs function without a varargs (...) declaration 
> in julia could corrupt a program, although it seems that only the SysV 
> x86_64 ABI seems to make a distinction (if there are XMM registers in use).
>
> On Mon, Mar 16, 2015 at 12:38 AM J Luis <[email protected] <javascript:>> 
> wrote:
>
> In my machine (Win8 64), 488 is the size limit for that immutable. 
>
> With 489 ==> Kaboomm
>
> segunda-feira, 16 de Março de 2015 às 04:27:38 UTC, J Luis escreveu:
>
> I may have found a very important piece.
>
> If I shrink the immutable Array_1024_Uint8 in
>  https://github.com/joa-quim/IUP.jl/blob/master/src/libcd_h.jl#L154
> to, let say, 4 members than the whole program works again. So apparently 
> it's a size matter!
>
> segunda-feira, 16 de Março de 2015 às 03:06:14 UTC, J Luis escreveu:
>
> The changes referred in https://groups.google.com/foru
> m/?fromgroups=#!topic/julia-users/qi6HpMrAS_A broke IUP.jl in a way that 
> I simply cannot even identify where the breakage occurs.
>
> I managed to reproduce the crash with only one instruction, but even than 
> makes no sense to me. The next two lines crash julia
>
> julia> using im_view_
> julia> a=IUP.IupCanvas()
>
> It can be seen in https://github.com/joa-quim/IU
> P.jl/blob/master/src/libiup.jl#L480 that the wrapper is OK and if fact if 
> I comment the two lines (that leave in another module)
>
> https://github.com/joa-quim/IUP.jl/blob/master/src/IUP_CD.jl#L349
> https://github.com/joa-quim/IUP.jl/blob/master/src/IUP_CD.jl#L350
>
> that are include from the module im_view_ than I get an error of missing 
> function (normal, since I commented its inclusions) but otherwise all seam 
> to work.
> So I'm left with this back trace of which I'm unable to extract any useful 
> information.
>
> (On Win64 with a nightly from 2 days ago)
>
> Please submit a bug report with steps to reproduce this fault, and any 
> error messages that follow (in their entirety). Thanks.
> Exception: EXCEPTION_ACCESS_VIOLATION at 0x6bfb2b56 -- 
> jl_profile_is_running at V:\Julia-0.4.0-dev\bin\libjulia.dll (unknown line
> )
> jl_profile_is_running at V:\Julia-0.4.0-dev\bin\libjulia.dll (unknown line
> )
> jl_profile_is_running at V:\Julia-0.4.0-dev\bin\libjulia.dll (unknown line
> )
> jl_profile_is_running at V:\Julia-0.4.0-dev\bin\libjulia.dll (unknown line
> )
> jl_profile_is_running at V:\Julia-0.4.0-dev\bin\libjulia.dll (unknown line
> )
> jl_profile_is_running at V:\Julia-0.4.0-dev\bin\libjulia.dll (unknown line
> )
> jl_profile_is_running at V:\Julia-0.4.0-dev\bin\libjulia.dll (unknown line
> )
> jl_profile_is_running at V:\Julia-0.4.0-dev\bin\libjulia.dll (unknown line
> )
> jl_profile_is_running at V:\Julia-0.4.0-dev\bin\libjulia.dll (unknown line
> )
> jl_profile_is_running at V:\Julia-0.4.0-dev\bin\libjulia.dll (unknown line
> )
> jl_profile_is_running at V:\Julia-0.4.0-dev\bin\libjulia.dll (unknown line
> )
> jl_profile_is_running at V:\Julia-0.4.0-dev\bin\libjulia.dll (unknown line
> )
> jl_profile_is_running at V:\Julia-0.4.0-dev\bin\libjulia.dll (unknown line
> )
> jl_profile_is_running at V:\Julia-0.4.0-dev\bin\libjulia.dll (unknown line
> )
> jl_profile_is_running at V:\Julia-0.4.0-dev\bin\libjulia.dll (unknown line
> )
> jl_profile_is_running at V:\Julia-0.4.0-dev\bin\libjulia.dll (unknown line
> )
> jl_profile_is_running at V:\Julia-0.4.0-dev\bin\libjulia.dll (unknown line
> )
> jl_profile_is_running at V:\Julia-0.4.0-dev\bin\libjulia.dll (unknown line
> )
> jl_gc_collect at V:\Julia-0.4.0-dev\bin\libjulia.dll (unknown line)
> allocobj at V:\Julia-0.4.0-dev\bin\libjulia.dll (unknown line)
> jl_init_tasks at V:\Julia-0.4.0-dev\bin\libjulia.dll (unknown line)
> jl_alloc_cell_1d at V:\Julia-0.4.0-dev\bin\libjulia.dll (unknown line)
> jl_f_new_expr at V:\Julia-0.4.0-dev\bin\libjulia.dll (unknown line)
> inlineable at inference.jl:2372
> jl_apply_generic at V:\Julia-0.4.0-dev\bin\libjulia.dll (unknown line)
> inlining_pass at inference.jl:2914
> jl_apply_generic at V:\Julia-0.4.0-dev\bin\libjulia.dll (unknown line)
> inlining_pass at inference.jl:2809
> jl_apply_generic at V:\Julia-0.4.0-dev\bin\libjulia.dll (unknown line)
> typeinf_uncached at inference.jl:1745
> jlcall_typeinf_uncached_111 at  (unknown line)
> jl_apply_generic at V:\Julia-0.4.0-dev\bin\libjulia.dll (unknown line)
> typeinf at inference.jl:1386
> jlcall_typeinf_84 at  (unknown line)
> jl_apply_generic at V:\Julia-0.4.0-dev\bin\libjulia.dll (unknown line)
> typeinf at inference.jl:1345
> jl_apply_generic at V:\Julia-0.4.0-dev
> ...
>
> ...

Reply via email to