I want to parameterize the return type of a ccall call that otherwise will
return a pointer to void. So I tried
function create_data(API::Ptr{None}, family, geometry, mode, par,
wesn::Ptr=C_NULL, inc::Ptr=C_NULL, reg=0, pad=2, data::Ptr{Void}=
C_NULL)
if (family == GMT_IS_VECTOR)
ret_type = Ptr{GMT_VECTOR}
elseif (family == GMT_IS_IMAGE)
ret_type = Ptr{GMT_IMAGE}
else
ret_type = Ptr{None}
end
ptr = ccall((:GMT_Create_Data,lib), ret_type, (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
but it errors saying that ret_type is not defined.
julia> V = create_data (API, 5, 1, 0, dim)
ERROR: ret_type not defined
How come that it's 'not defined' ?????