Yichao, could you explain why this is unsafe? Do you know of an alternative which is safe?
On Monday, 20 June 2016 16:31:29 UTC-3, Yichao Yu wrote: > > On Mon, Jun 20, 2016 at 3:27 PM, Stephen Chisholm <[email protected] > <javascript:>> wrote: > > While helping out with > > > http://stackoverflow.com/questions/37913625/call-julia-svd-from-c/37929076#37929076 > > > I noticed jl_tuple2 was removed in > afd4eb038dcd9fa3e512509f4c332a9e7763ba59 > > by Jeff Bezanson while refactoring tuples. Just wondering if anyone is > able > > to help me find an alternative. Below is what I used to be able to do. > My > > current work around is to use jl_eval_string("(2,2)"), but I'm hoping > that > > there is still a way to build the dims parameter without a call to > > jl_eval_string. > > > > > > double m[] = {1,2,3,4}; > > > > jl_value_t *array_type = jl_apply_array_type(jl_float64_type, 2); > > jl_tuple_t *dims = jl_tuple2(jl_box_int64(2), jl_box_int64(2)); > > FYI, this is generally unsafe. > > > jl_array_t *jl_m = jl_ptr_to_array(array_type, m, dims, 0); > > > > >
