Hi, this is more a guess but could you try changing the return type in 
ccall to NTuple{3,Ptr{Any}}? Or maybe just Tuple. Further you could try 
using on the left hand site only a single variable name, i.e.

tup = = ccall((:my_c_function, "mylib"), Tuple, ())

Am Donnerstag, 10. April 2014 09:15:30 UTC+2 schrieb Dominique Orban:
>
> My use case is a C function that creates a sparse matrix in triplet form 
> (rows, cols, vals). What's the appropriate way to return this to Julia? 
> I've tried the following, thinking that Julia accepts C pointers as return 
> values, so why not tuples of C pointers:
>
> jl_value_t *my_c_function(void) {
>
>   jl_tuple_t *tuple = jl_alloc_tuple(3);
>   long *rows, *cols;
>   double *vals;
>
>   // allocate and populate rows, cols and vals...
>
>   jl_tupleset(tuple, 0, rows);
>   jl_tupleset(tuple, 1, cols);
>   jl_tupleset(tuple, 2, vals);
>
>   return (jl_value_t*)tuple;
> }
>
> (The intention is then to call ptr_to_array() on each component of the 
> tuple.) In Julia, I call this C function as follows:
>
> (rows, cols, vals) = ccall((:my_c_function, "mylib"), Ptr{Any}, ())
>
> But that gives me
>
> ERROR: no method start(Ptr{Any})
>
> I'm sure there's more than one mistake in that code, but I'm not finding 
> documentation on the Julia API.
>
> Thanks!
>

Reply via email to