> > Can the output, jl_value_t* ret, point to more than one output argument?
Only as a tuple or array, On Thu, Jan 7, 2016 at 12:26 AM, Shamika <[email protected]> wrote: > Can the output, jl_value_t* ret, point to more than one output argument? > > On Wednesday, January 6, 2016 at 7:45:33 PM UTC+5:30, Stefan Karpinski > wrote: >> >> On Wed, Jan 6, 2016 at 12:15 AM, Shamika <[email protected]> wrote: >> >>> >>> I'm using Julia in c++ code. I have a few doubts regarding the jl_call >>> function.The code is >>> >>> jl_array_t *ret = (jl_array_t*)jl_call(func,args,nargs); >>> >>> 1. Can args contain both scalar/array values? >>> >> >> Yes, both scalar and array values are represented on the C side as >> jl_value_t*. Args will be a pointer to an array of jl_value_t* values – >> i.e. an array of pointers (of length nargs). Some of those pointers can >> point to scalar values on the heap, some can point to array values. These >> can be distinguished by their type tags, which there are various macros to >> access. >> >> >>> Does it use zero based or one based indexing? >>> >> >> Zero-based: everything on the C side is zero-based. >> >> >>> 2. Is there any data type that can hold both scalar/array output that is >>> returned by jl_call? Right now, I have to define the output as jl_value_t >>> or jl_array_t. Is there something more generic? >>> >> >> As I explained above, jl_value_t* is strictly more generic than >> jl_array_t*. You can think of these as corresponding to Any and Array in >> Julia – Array is a subtype of Any. >> >
