I think Jacob was suggesting something like this:
function create_data(API::Ptr{None}, family=5, geometry=1, mode=0,
par::Ptr=C_NULL,
wesn::Ptr=C_NULL, inc::Ptr=C_NULL, reg=0, pad=2,
data::Ptr{None}=C_NULL)
Have you tried that? (The Ptr types are loosened by removing the type
parameter).
-- Leah
On Mon, Mar 10, 2014 at 8:23 PM, J Luis <[email protected]> wrote:
>
> Thanks, but if I try without default values
>
> function create_data(API::Ptr{None}, family, geometry, mode,
par::Ptr{Culonglong},
> wesn::Ptr{Cdouble}, inc::Ptr{Cdouble}, reg, pad, data::Ptr{None})
>
> I still get the same error, and note that the Culonglong was not using
the C_NULL default value before. It's the 'dim' parameter below.
>
> using GMT; API=create_session(); dim=uint64([2,9]);
>
>
> 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})
>
>
>
>
> Terça-feira, 11 de Março de 2014 0:29:32 UTC, Jacob Quinn escreveu:
>>
>> 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 <[email protected]> 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 int
geometry,
>>> 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
>>
>>