Not sure, but my guess would be that C_NULL is not being accepted as a
Ptr{Culonglong} or Ptr{Cdouble} since it's type is Ptr{Void} (or
Ptr{None}). You can either remove those type annotations or just use Ptr as
the type annotation to test this theory.

-Jacob


On Mon, Mar 10, 2014 at 8:20 PM, J Luis <jmfl...@gmail.com> wrote:

> I have spend some hours around this but I'm not getting nowhere. The
> following C function has this signature
>
> void *GMT_Create_Data (void *API, unsigned int family, unsigned intgeometry
> ,
>                         unsigned int mode, uint64_t par[], double *wesn,
>                         double *inc, unsigned int registration, int pad,
> void *data)
>
>
> A Clang.jl conversion produced
>
> @c Ptr{None} GMT_Create_Data (Ptr{None}, Uint32, Uint32, Uint32, Ptr{
> Culonglong}, Ptr{Cdouble},
>         Ptr{Cdouble}, Uint32, Cint, Ptr{None}) gmt_w64
>
> than I manually try to replicate it so that I can use default values, and
> I wrote it as
>
> function create_data(API::Ptr{None}, family=5, geometry=1, mode=0, par::
> Ptr{Culonglong}=C_NULL,
>         wesn::Ptr{Cdouble}=C_NULL, inc::Ptr{Cdouble}=C_NULL, reg=0, pad=2,data
> ::Ptr{None}=C_NULL)
>
>     ptr = ccall((:GMT_Create_Data,lib), Ptr{None}, (Ptr{None}, Uint32,
> Uint32, Uint32, Ptr{Uint64},
>         Ptr{Cdouble}, Ptr{Cdouble}, Uint32, Cint, Ptr{None}),
>         API, uint32(family),uint32(geometry),uint32(mode),par,wesn,inc,
> uint32(reg),int32(pad), data)
> end
>
> However, no matter what I try the manual version always error
>
> julia> V = create_data (API, 5, 1, 0, dim, C_NULL, C_NULL, 0, 0, C_NULL)
> ERROR: no method create_data(Ptr{None}, Int64, Int64, Int64, Array{Uint64,
> 1}, Ptr{None}, Ptr{None}, Int64, Int64, Ptr{None})
>
> or
>
> julia> create_data(API)
> ERROR: no method create_data(Ptr{None}, Int64, Int64, Int64, Ptr{None},
> Ptr{None}, Ptr{None}, Int64, Int64, Ptr{None})
>  in create_data at C:\progs_cygw\GMTdev\julia\GMT\src\GMTfuns.jl:22
>
> but the automatic one runs fine
>
>
> julia> V = GMT_Create_Data (API, 5, 1, 0, dim, C_NULL, C_NULL, 0, 0,C_NULL
> )
> Ptr{Void} @0x0000000000216210
>
>
> What am I doing wrong?
>
> Thanks
>

Reply via email to